

$destinationContext = $destStorageAccount.Context #Capture the context of the storage account $destStorageAccount = New-AzStorageAccount -name $destStorageAccountName -Location $destinationRegion -ResourceGroupName $destResourceGroupName -SkuName Standard_LRS $destStorageAccountName = "sadestvvillar" #Assign the name of the storage account where you want to copy the snapshot (lowercase and no special characters) New-AzResourceGroup -Name $destresourceGroupName -Location $destinationRegion Get-AzLocation | select Location) $destinationRegion ="brazilsouth" #(If we want to bring the list of regions you can execute the command #Provide the name of the destination region where the resource group will be created and the resources to be migrated Add the following commands: #Assign the name of the destination resource group Note: To find the subscription ID to add it to the -Subscription parameter, in the Azure portal go to the Subscriptions resource and there you will see the Subscription ID.Ĥ. If you have multiple subscriptions in your account execute the command: Select-AzSubscription -Subscription Enter the credentials of your Azure subscriptionģ.

To perform the activities, we need the source virtual machine and with the following commands create resources and copy the information of the virtual machine in order to create a new one with the same information.ġ.Enter to the PowerShell ISE program and enter to your subscription with the command: Connect-AzAccountĬlick on the run script button or press F5Ģ. Taking the disk snapshot of the virtual machine as a VHD to a Storage Account Prerequisites:ĭisclaimer: Given the constant updating of Cloud Computing technologies some steps may be different at the time of reading the article, I will make the effort to keep it updated, but there could be some differences between what is shown below and the Azure console at the moment of the implementation. Hello, in this article we will see how to perform a migration from one virtual machine to another region, while we can assign it to another group of resources and change its name.
