AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 13.05.2014, 08:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,497 / 847 (79) +++++++
Регистрация: 28.10.2006
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 Soon after that I realized there is no option to unlink it again. So there you have it, the LCS project and one of my subscriptions are married to one another now!

So I had two options here:
  • Delete the VM in Azure and redeploy a new one from LCS
  • Copy the VM from one subscription to another.
The first one was the easy one, so to have a bit of a challenge I went and chose the second option. Let’s write some PowerShell stuff to get things copied from one subscription to another! Here is how you have to do just that:

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.

Copy the virtual machine between subscriptions

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, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
AIF: Microsoft Dynamics AX Services and Windows Azure Service Bus Blog bot DAX Blogs 0 24.07.2013 03:13
Axilicious:Running AX2012 R2 locally on Windows 2012 Server booted directly from VHD Blog bot DAX Blogs 0 16.04.2013 08:13
dynamics-coe: Using Windows Azure Blog Storage with Dynamics CRM Blog bot Dynamics CRM: Blogs 0 11.02.2013 13:11
MSDAX 4.0 и планировщик win server 2008 werov2010 DAX: Администрирование 11 16.08.2012 14:18
sanjayjain: Windows Azure – How Do I: Hello Azure (Part 1) Blog bot Dynamics CRM: Blogs 0 13.01.2012 23:12

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 01:16.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.