Monthly Archives: October 2016

AzureRM: Move Virtual Machines to a new subscription

I have a subscription which ends soon, which forces me to migrate my resources to a new subscription. I have used the DevTestLab service to create my System Center test environment, which is a nice feature, but also has some limitations as some resources are locked. I tried to use the Azure PowerShell commands to migrate the resources or tried it directly in the console, but there were always parts which could not be migrated so the Validation failed. The other option I found is directly copy the blob storage. Here are two blog posts about it:
http://gauravmantri.com/2012/07/04/how-to-move-windows-azure-virtual-machines-from-one-subscription-to-another/
https://blogs.msdn.microsoft.com/laurelle/2015/10/01/how-to-move-azure-vm-between-subscriptions/

Both reference the old portal. That cannot be used for virtual machines which are part of a DevTestLab as they are AzureRM resources, which can only be managed in the new Azure Portal.

Both solutions need a tool to browse and copy the blob storage. I have also used the free CloudBerry Explorer for Azure Blob Storage. It reminded me a bit of the old File Commander ;-).

So to move my virtual machines, I had to find out, which storage account was used in my old DevTestLab. Open up your DevTestLab and click on the resource group name in the overview.

ResGroup.jpg

You will see all resources which belong to this resource group:

ResGroupDetails.jpg

I have two storage accounts, by selecting one-by-one, I find out which one holds the virtual machines.

storageaccount

Click on Blobs and then on Vhds.vhds

The entries with the Page blob type are the vhds, the Block blob type are the VM Status files.

Now I know the Storage account. Then I created a new DevTestLab in my new subscription and checked which resources are there. There were two storage accounts, both with blob storage assigned, but without entries. Okay. I do not have the details which one you should select, but I selected the first one in the list. Now I have the names of both storage accounts.

To reference these accounts for the copy job, I need one more thing: the Access key. To find that open up the Storage accounts service in your Azure Portal.
StorageAccounts.JPG
Select your storage account, click on Access keys and copy the first key.

You will need to do that for both storage accounts when you create your connection in CloudBerry Explorer.

So open up CloudBerry Explorer and create the connection to both of your storage accounts (old subscription, new subscription).

CloudBerry-NewAzureblobStorage.JPG
Enter a Display name, the name of the Storage account and the shared key (which you copied before).

CloudBerry.JPG

When you have entered both Storage accounts, then you can browse them. On the old storage account browse to Root\Vhds and on the new one to Root\Uploads.

Then select the vhd files one by one and click copy. A queued copy job will start.

CloudBerryUploads.JPG
The job will close as soon as it is finished.

Now you can go back to the Azure Portal and to your new DevTestLab. The next step is to create Custom Images and the last step is to create the VMs with it.

  1. Create Custom Images
    In you DevTestLab Service, select your lab. Then select Configuration, Custom Images:
    CreateCustomImage.JPG
    Click Add.
    CustomImage.JPG
    Enter a Name for the Image, select the correct VHD and select the OS configuration.
    Click OK and the custom image gets created. Wait until this is finished successful.
  2. Create new VMs
    Now go back to My Virtual Machines in your new DevTestLab.
    newvm
    Click Add. And you will see your Custom Images at the top of the base selection.vmbase

You can go on with your VM creation as you are used to within your first DevTestLab. If you create a Domain Controller, as I still have it (yes, I should move to Azure AD, will do that later ;-)), then remember to give it a static IP and enter that Ip in the DNS Server configuration of your Azure Network – not in the VM!

When you have verified that the VMs are running in your new DevTestLab, then you can delete your old one and you are done.

Surely you can also use this process to move any other VM which is not part of a DevTestLab.

That is it! Have fun with it :-).

Azure: Move OMS Resource Group to new Subscription

Sometimes you have to move Azure resources to a new subscription. One reason could be that your current subscription will end and you have a new one, which you want to use. Another reason could be that you need to migrate it to a subscription of someone else (demerger, etc.).

Anyhow if you do not want to loose the connection with your SCOM environment or your directly connected agents, how can I get this done? One way is always PowerShell, but I want to show you here, how you can do that within the Azure portal.

So open up http://portal.azure.com and Login.

Then go to Log Analytics and check which resource group you need to move.

oms

Now go to Resource Groups and select your resource group (here OMS).

In the Details view of the resource group you will have at the top the Move button.

OMSMove.JPG

You can now select all resources which belong to this resource group.

move

Select the new subscription and create a new resource group or select an existing one in the new subscription.

The problem which we get now is that the validation fails. Why? When you have Solutions selected in your OMS environment, which you normally have, then these cannot be moved. You need to remove them first and then the move works. The error gives the details:

Error: Resource move is not supported for resources that have plan. Resources are ‘Microsoft.OperationsManagement/solutions/ADAssessment(Lab),Microsoft.OperationsManagement/solutions/ADReplication(Lab),Microsoft.OperationsManagement/solutions/AgentHealthAssessment and tracking id is ‘xxx’. (Code: ResourceMoveFailed)

So open up OMS (http://oms.microsoft.com/oms) and remove your Solutions.

omsagenthealth

Click Remove.

When you check in the azure portal, then you will see that the resource is deleted after the solution is removed. Do that for all Solutions in your OMS resource.

At the end it should look like this, when you click Move again:

omsmove2

Do not miss to select the check box at the bottom.

Then click OK.

The old resource group will be empty when the move task is finished. So you can delete it afterwards.

You can then enable the OMS solutions again, now that all your OMS resources are in the new resource group.

The necessarity to remove the solutions from OMS can be a problem in productive environments, not for test environments. So be cautious there.

Microsoft MVP

I am pleased to announce that I received the Microsoft MVP 2016 award for Cloud and Datacenter Management. Now I am part of the MVP family ☺️. The welcome kit arrived today. If you want to know more about the Award program, then you can follow the MVPAward blog. Here you can find more details about the award categories and you can also search for MVPs.

If you want to become a MVP, then you need to be active in the community (tweet, write your blog, speak at community meetings/conferences, share code, etc). When you already did that for a while, contact a MVP from your area and ask him/her, if he/she would nominate you. You could even ask for the MVP lead contact, they can also help you on your journey to become a MVP.

You  will receive an email from Microsoft, when you got nominated. Then you need to submit all your contributions to the community of the past year. And the you can only wait. There are special dates – one each quater – i.e. October 1st, when the award notifications are send out. This is the time, when all MVPs, who want to be renewed, wait nervously in front of their email programs 😉.

Thanks to everyone, who helped me on my journey and greetings to my fellow MVPs.