Automating the connection of your servers in Azure (PowerShell script) – English Version
After several days of thinking, I was wondering how to make it even easier to integrate servers into Azure.
That’s why I decided to set up a little script that can take care of that for us.
Our test infrastructure has a Domain Controller and two « DATA » servers that are in this domain:
- AD-SRV.info.local / IP= 192.168.1.62
- SRV-DATA.info.local / IP=192.168.1.65
- SRV-DATA02.info.local/ IP=192.168.1.64
The idea would be to reference all our servers in a .csv file that we will import in our script:
$CSV = Import-CSV -Path « C:\Users\AdministratorDesktop\script.csv » -Delimit « , »
Once this task is done, we will connect to Azure using the command :
Now we can create our loop:
If you want the script is available on my github here:
scriptazurearcserver/finalscriptarc.ps1 at main · technicalandcloud/scriptazurearcserver (github.com)
We will run our script on our DC, here is the CSV:
and our script:
Now we run, we are asked to connect:
After successful authentication, the script runs:
After a few minutes of patience, the servers are back in Azure:
I hope the script helps you, as it helps me!