Moving a Microsoft Azure VM to a Different Subnet Within a Virtual Network
Join the DZone community and get the full member experience.Join For Free
in microsoft azure, an administrator can now use powershell to migrate a vm from one subnet to another within the same virtual network. this offers an opportunity to reorganize an application topology for better managing subnet capacity and grouping. for instance, when an existing subnet, abc, is running out of ip addresses, customers can move the associated vms to a different and perhaps larger subnet. at this time, subnet abc can then be deleted to recover the ip address space.
the logical process to carry out a subnet migration is to:
- migrate a vm from one subnet to another, followed by
- update the vm configuration which will restart the vm
the msdn documentation at http://msdn.microsoft.com/en-us/library/azure/dn643636.aspx offers a sample powershell statement as below.
<a target vm name>
<the associated service name>
| set-azuresubnet –subnetnames <a target subnet to migrate to> `
and i am here providing a sample scenario of moving a vm from a dev subnet to a test one as illustrated below.
a virtual network, foonet, has three subnets: ad, dev, and test, while each subnet is configured with a specific ip address range as shown.
|the intent is to move the vm, app1, currently in dev to the subnet, test.|
|the vm, app1, is deployed to the service, foo-devtest, i.e. http://foo-devtest.cloudapp.net.|
ise session is connecting to the microsoft azure subscription account
and has successfully moved the vm to the target subnet, test.
for those who are not familiar with microsoft azure powershell, a self-training tool called quick start kit (qsk) is available at http://yungchou.wordpress.com/2014/01/21/announcing-windows-azure-iaas-quick-start-kit-qsk-at-http-aka-ms-qsk/ .
|the vm now resides in the subnet, test.|
Published at DZone with permission of Yung Chou, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.