網頁

2014年10月26日 星期日

Microsoft Azure --- how to move VM from one cloud service to another


In the same Azure Subscription, each VM will build into a new cloud service if we create a new VM by taking the default set of options in the wizard. So do that we will reach the limit of 20 cloud service and the next new VM cannot be created besides apply for the request to Microsoft Cloud Help Desk.

“Whether VMs can move between different cloud services?” The following process will finish this thought.
Get the VM information by using the Get-AzureVM -servicename “<old cloud service name>” -name “<VM name>” command

擷取選取區域_001.jpg
Export this VM config by using the Export-AzureVM -ServiceName “<old cloud service name>” -name “<VM name>” -path “<.xml file>” command
擷取選取區域_002.jpg
Remove this VM from Azure but doesn’t delete the VHD file on disk (# 1) by using the Remove-AzureVM -ServiceName “<old cloud service name>” -Name “<VM name>” command
Edit the .xml file if we want to change local port number or Subnet Name for being compatible with the destination cloud service.
擷取選取區域_005.jpg
Ensure the current storage account is accessible by executing the Get-AzureSubscription command. If we find out the CurrentStorageAccount is blank, please choose what storage account this VMis in by using the set-AzureSubscription -SubscriptionName “<Azure Subscription>” -CurrentStorageAccount “<new Storage Account>” command. (# 2)
擷取選取區域_009.jpg
Import the VM config for creating this VM back to Azure by using the Import-AzureVM -path “<.xml file>” | New-AzureVM -ServiceName “<new cloud service name>” -VNetName “<virtual network name>” command.
擷取選取區域_011.jpg
So does that the VM has already been moved to another cloud service.
擷取選取區域_013.jpg

Reference :
(# 1)   Click on the Storage Icon on the left、select a storage account to open the Storage Main Page、click on the Containers tab and vhds item. We can see the removed VHD file in the list.
擷取選取區域_004.jpg
(# 2)   If the CurrentStorageAccountName is not defined, we will get the following error message when execute the Import-AzureVM powershell command.
擷取選取區域_006.jpg

沒有留言:

張貼留言

Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.