2013-05-17 25 views
5

我在嘗試什麼應該是一個非常基本的任務。我創建了一個工作站模板的本地VHD,我想要在Azure環境中使用它。我正在從Azure Powershell工作。使用Add-AzureVHD命令在Azure Powershell中上傳VHD問題

我已經上傳了我的.cer文件來創建管理證書。我已經導入了.publishsettings文件,我能夠使用的Set-AzureSubscription和選擇,AzureSubscription沒有明顯的問題:

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

Select-AzureSubscription -SubscriptionName "Windows Azure Enterprise" 

我遇到的問題是這樣的,當我嘗試使用外接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 

我相當肯定,我使用指定-destination的信息是正確的,因爲我已經從容器URL字段直接複製它的Azure的網站。

我哪裏錯了?我一直在使用幾個網站作爲指導給你什麼,我一直在工作,從一個想法:

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

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

我還試圖使用CSUPLOAD具有相同的基本步驟,並得到一個消息,指出「存儲帳戶沒有找到」,導致我相信我填充了一個錯誤信息的參數,但我真的很困惑我的錯誤是什麼。

很多,很多預先感謝!

+0

只是一個猜測,但你可以嘗試通過指定小寫的存儲帳戶名? –

+0

我也嘗試過,認爲這是窒息的上限入口,但它似乎沒有什麼區別。 –

回答

7

答案很簡單:

請確保您的存儲賬戶在同一訂閱中Set-AzureSubscription規定。

龍答:

發生了什麼事(我認爲)是,當你調用Set-Subscription,cmdlet不會檢查存儲帳戶是在相同的訂閱。現在,當您撥打Add-AzureVhd並指定目標URL時,該cmdlet需要查找存儲帳戶密鑰,並利用Get Storage Account Keys操作來利用訂閱ID和管理證書。由於此存儲帳戶在指定的訂閱中不存在,因此會出現「找不到資源」錯誤。

Set-AzureSubscription

Select-AzureSubscription

+1

這正是問題所在。只要我包含-SubscriptionId參數,它就像冠軍一樣踢開了。非常感謝! –

+0

當我運行Get-AzureSubscription時,它列出了兩個訂閱,並且存儲容器的一個既不是默認的也不是當前的。我運行了Select-AzureSubscription -SubscriptionName - 當前的cmdlet使正確的訂閱成爲當前,然後Add-AzureVhd cmdlet起作用。 –

4

我有問題的伎倆。