Bulk VM creation from CSV using Azure PowerShell
This sample talks about few basic aspects of Azure PowerShell,
1. Reading from CSV
2. Parameterizing PowerShell
3. Calling another PowerShell from PowerShell with Parameters
Now let’s see how the CSV lools like,
And I am going to use these three columns as input parameters for another script.
So to read this one might use this below script
I have another script which uses creates VM and it takes three inputs as parameters,
Few things to notice here,
1. It has two values as hardcoded (local variable) this can also be taken from CSV
2. I took the minimul parameter option so this one would creare VNET, Subnet, Public IP and so on. However, you can pass them all in CSV
3. This has a check if the resource group exits. If it does then it would not create the Resource Group.
Then the last part, calling the VM creation PowerShell to CSV read PowerShell. To do that,
You can get these files at,
File 1: https://github.com/wrijughosh/PowerShellWG/blob/master/meetup/ReadFromCSVNestedPS.ps1
File 2: https://github.com/wrijughosh/PowerShellWG/blob/master/meetup/CreateVM-parameter.ps1
Note: This might prompt you for credentials again and again. You can also create a global variable and pass it on to all the VM creation commandlet.
Namoskar!!!