![]() |
#1 |
Участник
|
Axilicious:Windows Azure : Copy VHD between subscriptions
Источник: http://www.ksaelen.be/wordpresses/dy...subscriptions/
============== Last week I was playing around with LifeCycle Services and tested out the ‘Cloud hosted environments’ feature. This is an awesome feature that will save many of you some hours in prepping demo virtual machines. (For now, it is only able to deploy a template environment suited for demo purposes, but more templates will be available later on) But, it didn’t take long until I discovered my first ‘missing feature’ here… namely I was stupid enough to link the wrong subscription to the LCS project and I ended up adding my pay-as-you-go subscription instead of the one with acual credit on it ![]() So I had two options here:
Install the Azure Powershell module You can download and install the Azure PowerShell module by running the Microsoft Web Platform Installer. When finished you can fire it up in Windows 8 by just typing “Power” at the home screen and you will see it right away :). Get you machine familiar with your Azure subscriptions To be able to run the powershell commands in the next part, you will first need to import your subscription settings on your machine. Your first command here will be: Get-AzurePublishSettingsFile When running this cmdlet, your browser will pop up and take you to the correct link to download the publish settings files. When you have downloaded the files, run the following cmdlet to import it on your machine: Import-AzurePublishSettingsFile "Path\subscriptionname.publishsettings" Copy the VHD disks between subscriptions Now that we are all set up, it’s time to start copying the virtual disks between the source and target subscription. Use the following script to do so. ### This assumes you have already imported the azure publishsettings file and the subscriptions are known on your machine.Select-AzureSubscription "MyCoolSubscriptionName" ### Defines the location of the VHD we want to copy$sourceVhdUri = "https://mysourcestorageaccountname.blob.core.windows.net/omitted_part_of_the_uri/AX2012R3_DEMO_OS.vhd" ### Defines the source Storage Account$sourceStorageAccountName = "mysourcestorageaccountname"$sourceStorageKey = "mywaytolongsourcestoragekey" ### Defines the target Storage Account$destStorageAccountName = "mytargetstorageaccountname"$destStorageKey = "myalsowaytolongtargetstoragekey" ### Create a context for the source storage account$sourceContext = New-AzureStorageContext –StorageAccountName $sourceStorageAccountName ` -StorageAccountKey $sourceStorageKey ### Create a context for the target storage account$destContext = New-AzureStorageContext –StorageAccountName $destStorageAccountName ` -StorageAccountKey $destStorageKey ### Name for the destination storage container$containerName = "dynamicsDeployments" ### Create a new container in the destination storageNew-AzureStorageContainer -Name $containerName -Context $destContext ### Start the async copy operation$blob1 = Start-AzureStorageBlobCopy -srcUri $srcUri ` -SrcContext $srcContext ` -DestContainer $containerName ` -DestBlob "AX2012R3_DEMO_OS.vhd" ` -DestContext $destContext ### Get the status of the copy operation$status = $blob1 | Get-AzureStorageBlobCopyState ### Output the status every 10 seconds until it is finished While($status.Status -eq "Pending"){ $status = $blob1 | Get-AzureStorageBlobCopyState Start-Sleep 10 $status} If you filled in the specifics of your own subscriptions, storage accounts, … you should see the following output while copying. ![]() Now that have transferred the virtual disks between subscriptions, we still have to copy the virtual machine between the two. And to do that, there is a nice script available on TechNet Script Center : Copy a Virtual Machine between subcriptions So there you have it, your VM is now copied to a second subscription and if you like, you can just remove it from the source subscription. Источник: http://www.ksaelen.be/wordpresses/dy...subscriptions/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|