通过 PowerShell 管理 azure cloud - 访问问题
Manage azure cloud via PowerShell - access problem
在我的 Azure 环境中,我配置了 MFA(使用 Azure AD 中的安全默认值启用了 MFA)。我想使用 Azure Powershell 连接到 Azure。我正在使用 cmdlet
Connect-AzAccount -Subscription "SubscriptionID"
我在 Azure AD 中拥有全局管理员角色,在订阅级别拥有所有者角色。在 MFA 之前,我能够 Connect-AzAccount
没有任何问题。现在,当我尝试 Connect-AzAccount
时,我得到的信息是:
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXCCAADDFF to authenticate.
我做推荐的步骤,使用提供的 link 提供的代码。大约 20 秒后,我在 PowerShell 控制台中收到一条错误消息
Connect-AzAccount: The provided account xx.yy@company.com does not have access to subscription ID "SubscriptionID". Please try logging in with different credentials or a different subscription ID.
警告信息中提到的code XXCCAADDFF
是指设备代码,可能是您启用了设备登录导致的。
您提到收到错误消息 The provided account xx.yy@company.com does not have access to subscription ID....
,您可以使用
Connect-AzAccount -TenantId <tenantId> -Subscription <subscriptionId>
而不是
Connect-AzAccount -Subscription <subscriptionId>
对于这个问题,这里有一个post与之相关。我这边也测试了一下,加-TenantId
就可以解决报错
在我的 Azure 环境中,我配置了 MFA(使用 Azure AD 中的安全默认值启用了 MFA)。我想使用 Azure Powershell 连接到 Azure。我正在使用 cmdlet
Connect-AzAccount -Subscription "SubscriptionID"
我在 Azure AD 中拥有全局管理员角色,在订阅级别拥有所有者角色。在 MFA 之前,我能够 Connect-AzAccount
没有任何问题。现在,当我尝试 Connect-AzAccount
时,我得到的信息是:
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXCCAADDFF to authenticate.
我做推荐的步骤,使用提供的 link 提供的代码。大约 20 秒后,我在 PowerShell 控制台中收到一条错误消息
Connect-AzAccount: The provided account xx.yy@company.com does not have access to subscription ID "SubscriptionID". Please try logging in with different credentials or a different subscription ID.
警告信息中提到的code XXCCAADDFF
是指设备代码,可能是您启用了设备登录导致的。
您提到收到错误消息 The provided account xx.yy@company.com does not have access to subscription ID....
,您可以使用
Connect-AzAccount -TenantId <tenantId> -Subscription <subscriptionId>
而不是
Connect-AzAccount -Subscription <subscriptionId>
对于这个问题,这里有一个post与之相关。我这边也测试了一下,加-TenantId
就可以解决报错