Azure Exam Tips Part 1 – Create an Azure VM in PowerShell

Tip #1 – I need to know how to create a Virtual Machine from PowerShell. Its something I have watched on videos and thought yeah that’s easy I can remember that, well turns out my memory isn’t so great and so in order to try to improve upon that I’m blogging it, and will practice these exams tips regularly in order to try to remember them.

Create a new Resource Group with a name and location, then do a get-credential to use a the logon details to the vm, and then do a New-AzureRmVm passing in 8 parameters.

So the points to note for Creating a VM in Azure from PowerShell are the following key points:-

Create a VM using PowerShell (know the order) 8 parameters

  1. New-AzureRmResourceGroup -ResourceGroupName “GregorExams” -Location “WestEurope”
  2. $cred = Get-Credential (this is where you supply the username and password for logging into the VM once its created)
  3. New-AzureRmVm
    -ResourceGroupName “GregorExams” -Name “GregVM1” -Location “WestEurope” -VirtualNetworkName “myVnet” -SubnetName “mySubnet” -SecurityGroupName “myNetWorkSecurityGroup”
    -PublicIpAddressName “myPublicIPAddress” -Credential $cred