Share via


Azure VM Networking: How To Set Static IP

It is important to set Static IPs on Azure virtual machines if you are having a lab. If you need to have resources and you shut them down, when you try to open them again they may get different IPs causing instability in your environment.

To set static IPs follow the below steps

  1. Install and configure Windows PowerShell for managing Azure: https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
  2. Open Azure PowerShell
  3. Set-ExecutionPolicy RemoteSigned
  4. Get-AzurePublishSettingsFile and follow the steps to save publishing settings file
  5. Import-AzurePublishSettingsFile -PublishSettingsFile "c:\Visual Studio Ultimate with MSDN-5-5-2015-credentials (1).publishsettings"
  6.  Get-AzureVM -ServiceName servicename -Name azureVMName | Set-AzureStaticVNetIP -IPAddress 10.0.0.4 |Update-AzureVM

To test if IP is used before setting IP

Test-AzureStaticVNetIP –VNetName vnetname –IPAddress 10.0.0.4

 Note: modify command parameters to point to your VM and your service