How to change Azure VM Virtual network when using Reserved IP address

We installed our Azure vm via powershell, because we needed to use Reserved IP address. Its not possible to add reserved IP address from portal yet.
We somehow forgot to add private VMnetwork to our Azure vm and we needed get it.
Software installations were already done, so we needed to keep the OS disk.
This blogpost will describe the steps what we need to do when we wanted to keep current OS disk and also reserved IP address and only add connection to our virtual network too.

First we removed Azure VM from portal, but keep the disks

Then we listed our disks via command Get-AzureDisk checked our OS disk details
Now we have the all needed details to configure “new” VM with existing OS disk.
First we needed to set  storage account

Then we created Azure VM with existing OS disk and added also same Reserved IP address and also correct virtual network

And finally vm is running with needed settings.

And now, what we learned from this
When creating Azure VMs via powershell and using reserved IP addresses, be sure to add your virtual network on parameters too 😀

For example like this:






Leave a Reply

Your email address will not be published. Required fields are marked *