In this blog, I am posting the basics of connecting Azure using PowerShell and deploy a virtual machine using a template available.
Set the PowerShell Execution Policy as required
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Download and install the Azure module in your computer
Install-Module AzureRM -AllowClobber
Run the ps script for the deployment found along with the template. Please remember to substitute the values including the subscription ID from Azure portal
PS C:\Users\mphilip\Desktop\Azure> .\deploy.ps1
cmdlet deploy.ps1 at command pipeline position 1
Supply values for the following parameters:
When asked, also provide the value for resourceGroupLocation: I have provided the value ‘southindia’ and you may provide it as per your preference. You will have to provide the azure login credentials too when asked
Another way of running the script is add the required parameters along with script as below
.\deploy.ps1 -subscriptionId xxxx -resourceGroupName test -deploymentName test
Handling some errors
If suppose, you found certain errors reported as “New-AzureRmResourceGroupDeployment : 2:12:05 PM – Error: Code=InvalidDeploymentParameterValue; Message=The value of deployment parameter ‘adminPassword’ is null. Please specify the value or use the parameter reference.” you will need to fix the value for adminpassword of the vm to be created in parameter file as below. It can be ‘null’ in your parameter file. Give the preferred value as below
How useful was this post?
Click on a star to rate it!
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!