Removing a static IP from an Azure VM

Last time I went through how to set a static IP on an Azure VM, how about removing it?

Well after connecting Azure (as as the previous blog) we need to grab the info for setting the variable so we need to do Get-AzureVM and note down the cloud (service name) and VM name then we need to set the variable:

$staticVM = Get-AzureVM –ServiceName <cloudname> -Name <nameofVM>

Now we can remove the static IP:

Remove-AzureStaticVNetIP -VM $staticVM -IPAddress <IPyouwishtoremove> | Update-AzureVM

*NOTE* This will restart the VM! I found that out the hard way.

 

Hope this helps!

About the author