Moving a Microsoft Azure VM to a Different Subnet Within a Virtual Network

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:

  1. Migrate a VM from one subnet to another, followed by
  2. Update the VM configuration which will restart the VM

The MSDN documentation at offers a sample PowerShell statement as below.

Get-AzureVM –Name <a target VM name> –ServiceName <the associated service name> `
| Set-AzureSubnet –SubnetNames <a target subnet to migrate to> `
| Update-AzureVM

And I am here providing a sample scenario of moving a VM from a DEV subnet to a TEST one as illustrated below.

image A virtual network, fooNet, has three subnets: AD, DEV, and TEST, while each subnet is configured with a specific IP address range as shown.
image The intent is to move the VM, app1, currently in DEV to the subnet, TEST.
image The VM, app1, is deployed to the service, foo-devtest, i.e.
image An 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
image The VM now resides in the subnet, TEST.

Creating Microsoft Azure virtual machine

There are a number of changes made recently in the process of creating a Microsoft Azure VM. This article presents a sample user experience of creating a VM from Microsoft Azure image gallery and with the quick create method, as of Aril of 2014, after a user has logged into Microsoft Azure Management Portal with a subscription account.

To acquire a Microsoft Azure free trial subscription while it is available, go to and click the dropdown list and select the option, Windows Server 2012 R2 on Windows Azure. Detailed instructions are available at

To Start

image This is to interactively deploy a Microsoft Azure VM. Using Microsoft Azure PowerShell, we can automate the entire process. Microsoft Azure Quick Start Kit (QSK) has a sample script.


image When creating a VM which is associated with a storage account, a cloud service, or a virtual network, must use FROM GALLERY option.
image There are two tiers i.e. BASIC and STANDARD, of hardware configuration of a VM, and each with a set of selected compute configurations available as show below.
image As of April of 2014, the Basic tier has a set of compute configurations from A0 to A4, while Standard is from A0 to A7. There are deployment constraints associated a Basic compute configuration. For instance, deploying a VM with a Basic tier configuration to a virtual network will error out with the following message,image
image Notice the endpoint configurations are by default with two preconfigured: one for RDP connections and the other for PowerShell remoting.
image There are 3rd-party extensions now available. These extensions which provides additional functionality to a VM instance can be installed, managed, and uninstalled from a VM, as needed.
image Upon a successful deployment, the VM becomes available.
image In this example, the VM is deployed to a virtual network with the IP address, The article provides additional information on the IP address management in Microsoft Azure virtual network.


QUICK CREATE method is for deploying a VM without concerning the associated artifacts including a cloud service name, a storage account, and a virtual network. This is a speedy way to deploy a VM for testing, troubleshooting, and training.

image QUICK CREATE requires just 7 pieces of information to deploy a VM. A cloud service name is to be created based on the DNS name, a storage account is to be created for current subscription account, and a VIP and a DIP are to be automatically assigned and managed by Microsoft Azure.
In this example, the VM is to be deployed with a Basic tier A1 with an Affinity Group which is not associated with a virtual network.
image If to deploy a VM with a Basic tier configuration with an Affinity Group which is associated with a virtual network, it will error out with the following message,image
image In this example, the VM is to be deployed with a Standard tier A1 with an Affinity Group which is associated with a virtual network.