【问题标题】:Azure powershell: Account with name '​' does not existAzure powershell:名称为“​”的帐户不存在
【发布时间】:2016-08-15 17:40:02
【问题描述】:

我正在使用 Azure 中的经典资源。我正在运行 Azure powershell 2.0.1 版(更新它以查看是否解决了以下问题)。 我想检查我的 VIPS 列表,并且正在运行一些我在 powershell 中为此准备的脚本。

$deployment = Get-AzureDeployment -ServiceName servicenamehere
$deployment.VirtualIPs

我现在收到错误

Get-AzureDeployment : Account with name '​' does not exist.
Parameter name: accountName
At line:1 char:15
+ $deployment = Get-AzureDeployment -ServiceName servicenamehere
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureDeployment], ArgumentException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentCommand

许多其他语句返回相同的错误“名称为 '' 的帐户不存在。”这一切都是在登录并选择我的订阅后执行的,效果很好:

Add-AzureAccount
Select-AzureSubscription -SubscriptionName "subscriptionnamehere"​

关于导致他们因这个 accountName 问题而失败的语句中发生的事情有什么想法吗?不确定这是否与资源管理器更改或 Azure 过去几个月中添加的任何其他新内容有关。

其他语句失败并出现相同的错误。示例

Add-AzureVirtualIP -VirtualIPName newvipname -ServiceName servicenamehere

给出同样的错误

Add-AzureVirtualIP : Account with name '​' does not exist.
Parameter name: accountName

【问题讨论】:

  • 尝试Select-AzureSubscription -SubscriptionName "subscriptionnamehere" -Account "accountidhere"(使用Get-AzureAccount查找正确的帐户ID)
  • 太好了,成功了!想知道为什么我现在需要那个。几个月前我们改用 Azure AD,不确定是否相关。

标签: powershell azure azure-powershell


【解决方案1】:

添加字符串时需要加上引号。

Select-AzureSubscription -SubscriptionName "subnamame" -Account "acname"

这通常是必需的,尤其是当您有超过 1 个参数时。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-28
    • 2017-07-21
    • 2019-07-16
    • 2021-01-31
    • 2021-05-26
    • 2017-01-17
    • 2017-11-05
    • 1970-01-01
    相关资源
    最近更新 更多