【问题标题】:set azure storage account as current storage account powershell将 azure 存储帐户设置为当前存储帐户 powershell
【发布时间】:2017-06-28 18:21:44
【问题描述】:

我拥有 azure 存储帐户(经典),我无法将其设置为 powershell 中的当前存储帐户,因为它显示 Set-AzureRmCurrentStorageAccount : The Resource 'Microsoft.Storage/storageAccounts/devstorageaccount' under resource group 'DEVENV' was not found.

我使用了Add-AzureRMAccount。 当我使用Add-AzureAccount 登录时,它只返回错误,因为我只是拥有owner 订阅角色。 那么如何在powershell中将存储帐户设置为当前存储帐户?

【问题讨论】:

    标签: powershell azure azure-storage


    【解决方案1】:

    如何在 powershell 中将存储帐户设置为当前存储帐户?

    我们可以使用set-azuresubcription 来做到这一点。

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

    请尝试使用以下代码:

    Add-AzureAccount 
    
    Set-AzureSubscription -SubscriptionName "subcription name" -CurrentStorageAccountName "storage name"
    
    Get-AzureSubscription 
    

    【讨论】:

    • 我试过了,它显示Set-AzureSubscription : The subscription name 'XXX' doesn't exist. ??? (我使用了add-azurermaccount,因为我无法使用 add-azureaccount` 登录,因为我不是管理员或联合管理员。我只是拥有所有者角色)
    • 同样的错误 - Select-AzureSubscription : The subscription name "xxx" doesn't exist.
    • 如果你使用arm账号,如Gaurav所说,经典存储账号不能设置为当前存储
    • 我怀疑你们所说的 arm 帐户是什么意思?是关于订阅还是 Azure 帐户?
    • 在这里查看我关于 ARM 的回答(虽然它是关于虚拟机,但您可以在那里了解 ARM 和 Classic 之间的区别):stackoverflow.com/questions/34737272/…
    【解决方案2】:

    Set-AzureRmCurrentStorageAccount 期望存储帐户是 Resource Manager (ARM) Storage Account,并且您提到您的存储帐户是 Classic 存储帐户。

    请尝试使用 ARM 存储帐户。

    【讨论】:

    • 我不能通过使用任何其他 powershell 命令将其设置为当前存储帐户来使用相同的经典存储帐户吗?
    • 我不这么认为。
    猜你喜欢
    • 2019-06-16
    • 2021-08-21
    • 1970-01-01
    • 2017-06-20
    • 2020-01-13
    • 1970-01-01
    • 2021-12-04
    • 2020-10-04
    • 2017-05-09
    相关资源
    最近更新 更多