June 11, 2015

Microsoft Azure - Move VM to another Subnet

# Check if there is any static IP assigned
Get-AzureVM "NAME_OF_VM" | Get-AzureStaticVNetIP

# If so remove this assignment and update VM
Get-AzureVM "NAME_OF_VM" | Remove-AzureStaticVNetIP | Update-AzureVM

# Move VM to Subnet2
Get-AzureVM "NAME_OF_VM" | Set-AzureSubnet -SubnetNames "Subnet2" | Update-AzureVM

Note: VM should be in running state.

# After updating VM you can verify if subnet was changed
Get-AzureVM "NAME_OF_VM" | Get-AzureSubnet

Useful article: How to move a VM or role instance to a different subnet

No comments:

Post a Comment