Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues uploading VHD in Azure Powershell with Add-AzureVHD commandlet

I'm attempting what should be a pretty basic task. I've created a local VHD of a workstation template that I want to upload for use in my Azure environment. I'm working from Azure Powershell.

I've uploaded my .cer file to create a management certificate. I've imported the .publishsettings file and I'm able to use Set-AzureSubscription and Select-AzureSubscription with no apparent issues:

Set-AzureSubscription -SubscriptionName "Windows Azure Enterprise" -CurrentStorageAccount ATOQA

Select-AzureSubscription -SubscriptionName "Windows Azure Enterprise"

The problem I run into is this when I attempt to use Add-AzureVHD:

PS C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\bin> add-azurevhd -destination "https://ATOQA.blob.core.windows.net/vhds/ztemplate-W7.vhd" -localfilepath "C:\VM\W7_Template\ztemplate-w7.vhd"
add-azurevhd : "An exception occurred when calling the ServiceManagement API. HTTP Status Code: 404. Service Management Error Code: ResourceNotFound. Message: The requested storage account 
'atoqa' was not found.. Operation Tracking ID: df91c24901254047b39a7a7d5b037ea0."
At line:1 char:1
+ add-azurevhd -destination "https://ATOQA.blob.core.windows.net/vhds/ztemplate-W7 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureVhd], ServiceManagementClientException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.StorageServices.AddAzureVhdCommand

I'm fairly certain that the information I'm using to specify the -destination is correct, since I've copied it directly from the container URL field on the Azure site.

Where am I going wrong? I've been using a few websites as guides to give you an idea of what I've been working from:

http://www.cloudtec.ch/blog/tech/upload-vhd-to-azure.html

http://msdn.microsoft.com/en-us/library/windowsazure/dn205185.aspx

I've also attempted to use CSUPLOAD with the same basic steps and get a message that states "storage account was not found", leading me to believe i'm populating a parameter with the wrong information, but I'm really confused on what my mistake is exactly.

Many, many thanks in advance!

like image 205
Ben Fishel-Brown Avatar asked May 17 '13 13:05

Ben Fishel-Brown


People also ask

Which two solutions should you use to transfer an on premises virtual hard disk VHD to Azure?

Generally, you should use Add-AzVHD. However, if you need to upload a VHD that is larger than 50 GiB, consider uploading the VHD manually with AzCopy. VHDs 50 GiB and larger upload faster using AzCopy. For guidance on how to copy a managed disk from one region to another, see Copy a managed disk.

Does Azure support VHD?

Azure supports both generation 1 and generation 2 VMs that are in VHD file format and that have a fixed-size disk. The maximum size allowed for the OS VHD on a generation 1 VM is 2 TB. You can convert a VHDX file to VHD, convert a dynamically expanding disk to a fixed-size disk, but you can't change a VM's generation.

How do I connect to Azure storage using PowerShell?

To sign in to your Azure account with an Azure AD account, open PowerShell and call the Connect-AzAccount cmdlet. After the connection has been established, create the storage account context by calling the New-AzStorageContext cmdlet.


1 Answers

Short Answer:

Please ensure that your storage account is in the same subscription as specified in Set-AzureSubscription.

Long Answer:

What's happening (I think) is that when you call Set-Subscription, the cmdlet doesn't check if the storage account is in the same subscription. Now when you call, Add-AzureVhd and specify the destination URL, the cmdlet need to find the storage account key and makes use of Get Storage Account Keys operation for that making use of subscription id and management certificate. Because this storage account does not exist in the specified subscription, you get Resource Not Found error.

like image 115
Gaurav Mantri Avatar answered Sep 30 '22 13:09

Gaurav Mantri