2017-02-10 128 views
0

我有蔚藍存儲帳戶(經典)和,因爲它顯示Set-AzureRmCurrentStorageAccount : The Resource 'Microsoft.Storage/storageAccounts/devstorageaccount' under resource group 'DEVENV' was not found.設置Azure存儲帳戶作爲當前存儲帳戶的powershell

我用Add-AzureRMAccount我不能將其設置爲當前存儲帳戶中的powershell。 當我使用Add-AzureAccount登錄時,它只返回錯誤,因爲我只有owner角色訂閱。 因此,如何在PowerShell中將存儲帳戶設置爲當前存儲帳戶?

回答

1

Set-AzureRmCurrentStorageAccount預計存儲帳戶爲Resource Manager (ARM) Storage Account並且您提到您的存儲帳戶是Classic存儲帳戶。

請通過使用ARM存儲帳戶嘗試。

+0

我不能使用,通過使用任何其他PowerShell命令同樣經典的存儲賬戶設置,作爲當前存儲帳戶? –

+0

我不這麼認爲。 –

2

我怎麼可以設定存儲帳戶在PowerShell中當前存儲賬戶?

我們可以用set-azuresubcription來做到這一點。

Set-AzureSubscription -SubscriptionName "xxx" -CurrentStorageAccountName "xxx" 

請試試用下面的代碼:

Add-AzureAccount 

Set-AzureSubscription -SubscriptionName "subcription name" -CurrentStorageAccountName "storage name" 

Get-AzureSubscription 

enter image description here

+0

我試過了,它顯示'Set-AzureSubscription:訂閱名'XXX'不存在。 (我用'附加azurermaccount'因爲我無法登錄使用add-azureaccount'因爲我不管理或共同管理,我只是有主人的角色。) –

+0

同樣的錯誤 - '選擇-AzureSubscription:訂閱名稱「XXX」不exist.' –

+0

如果你用手臂帳戶,如拉夫提到經典的存儲帳戶不能設置爲當前存儲 –