Azure

How to change VM Public IP address without stopping the VM

To change the Public IP address of your VM, without stopping it, the following steps will help. Its a combination of CLI and PS scripts for a quick reference 🙂

  1. Login to your Azure tenant with PowerShell
  2. I hope, you already have a VM with a public IP address assigned. So, un-assign the public IP$nic = Get-AzNetworkInterface -Name vmpub1930 -ResourceGroup manurg1 $nic.IpConfigurations.publicipaddress.id = $null Set-AzNetworkInterface -NetworkInterface $nic
  3. Create a New Public IPaz network nic ip-config update --name ipconfig1 --nic-name vmpub1930 --resource-group MANURG1 --public-ip-address myVMPublicIP
  4. Assign the new Public IP to the VMaz network nic ip-config update --name ipconfig1 --nic-name vmpub1930 --resource-group MANURG1 --public-ip-address myVMPublicIP