Saturday, April 26, 2014

Stop copy of Azure Virtual Machine from one subscription to another subscription using Azure Powershell

Technologies - Azure Blob sorage and Poweshell sdk 2.3 and above...

If you wish to take back up of azure virtual machine, the best way is to use Windows Azure Powershell cmdlets. Also there is an excellent post written about copying the azure virtual machine across subscriptions here -

However sometimes it may happen that you start copying of Azure Virtual machine to a storage account and finds that the selected storage account is not the intended one. Then you might want to stop the copy operation of azure virtual machine immediately. In such case following guide will help you to stop the copy operation of virtual machines.
The copy operation can be started with powershell command Start-CopyAzureStorageBlob.
Similarly to stop Azure blob copy operation we have Stop-AzureStorageBlobCopy command.

Let’s walkthrough the each step required to stop the blob copy operation in case of Azure virtual machine or in case of any blob copy operation. The same steps can be used for soppting all types of blob copy operation and it is not specific for stopping azure virtual machine vhd copy.

Can not find your azure storage credentials – Windows Azure Storage

I was performing an operation in powershell to copy blob from one storage account to another storage account. But before that I was trying to get the blobs present in container by using powershell command –
Get-AzureStorageBlob -Container vhds
When you fire this command you will receive error stated as below –
“Can not find your azure storage credentials.”
The reason is you have not set the context for current storage operation. The total scripts should be as follows –

Thursday, April 17, 2014

How to create Azure virtual machine using Visual Studio and Azure SDK 2.3

In build 2014 Day 2 keynote, the new capability of visual studio was demonstrated about creating Azure Virtual Machine without login to the Azure management portal. With the release of Azure SDK 2.3, now you can create an Azure Virtual Machine from visual studio itself. Following steps walks you through the same –
Open Server Explorer in visual studio 2012 and right click Virtual Machines option. Then select “Creation Virtual Machine” option as shown below –

A dialog box appears. Sign in to your account and select subscription in which you wish to create Azure Virtual Machine.

Then you can select the image from which you wish to create the virtual image. Either you can use standard image from option Platform Images, or you can choose MSDN images. If you already have images captured from other virtual machines then you can create virtual machine from these captured images as well.

However you cannot create Azure Virtual Machine from “My Disks” option which is available on Azure Management Portal.

Select the image of your choice and click Next. I have chose Windows Server 2008 R2 SP1 for this demo. Enter basic details for selected VM image.

Then select existing cloud service or create new. Based on virtual network configuration for selected cloud service data in Subnet and Virtual network dropdown will populate. If cloud service does not belong to virtual network then these dropdowns will be disabled.

You can modify the existing, add new or delete existing endpoints as shown below –

Click on Create to start creating azure virtual machine. The progress can be viewed from Azure Activity Log in visual studio. However the way we can cancel the ongoing deployment in case of Cloud Service Deployment, Azure VM Cancellation is not supported. Refer below screenshot –

Hope this helps.

Happy Provisioning!!!