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
- Install and configure Windows PowerShell for managing Azure: https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
- Open Azure PowerShell
- Set-ExecutionPolicy RemoteSigned
- Get-AzurePublishSettingsFile and follow the steps to save publishing settings file
- Import-AzurePublishSettingsFile -PublishSettingsFile "c:\Visual Studio Ultimate with MSDN-5-5-2015-credentials (1).publishsettings"
- 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