Set static IP to Azure VM

First of all, the VM must be within a virtual network to be able to add a static Private IP address

There are two ways to set a static private IP. One is using the new Azure Portal “portal.azure.com” and one via PowerShell.

Using the new Portal, browse a VM, select settings and then IP addresses. There at the Private IP address you can select “Static” and add the IP address.

Using PowerShell, first connect to the Azure , and use the following commands:

#Test IP availability:
Test-AzureStaticVNetIP -VNetName XXXXXXX -IPAddress

#Set the VM that will take the static IP
$static = Get-AzureVM -ServiceName xxxxx -Name xxxxxx

#Set the static IP
Set-AzureStaticVNetIP -VM $static -IPAddress xx.xx.xx.xx | Update-AzureVM

#Check the static IP
Get-AzureStaticVNetIP -VM $staticVM

 

 

Share