Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过PowerShell管理azure云-访问问题_Powershell_Azure Active Directory_Azure Powershell - Fatal编程技术网

通过PowerShell管理azure云-访问问题

通过PowerShell管理azure云-访问问题,powershell,azure-active-directory,azure-powershell,Powershell,Azure Active Directory,Azure Powershell,在我的Azure环境中,我配置了MFA(使用Azure AD中的安全默认设置启用了MFA)。我想使用Azure Powershell连接到Azure。我正在使用cmdlet Connect-AzAccount -Subscription "SubscriptionID" 我在Azure AD中具有全局管理员角色,在订阅级别具有所有者角色。在MFA之前,我能够连接AzaAccount,没有任何问题。现在,当我尝试连接AzaAccount时,我获得了以下信息: WARNING:

在我的Azure环境中,我配置了MFA(使用Azure AD中的安全默认设置启用了MFA)。我想使用Azure Powershell连接到Azure。我正在使用cmdlet

Connect-AzAccount -Subscription "SubscriptionID"
我在Azure AD中具有全局管理员角色,在订阅级别具有所有者角色。在MFA之前,我能够
连接AzaAccount
,没有任何问题。现在,当我尝试
连接AzaAccount
时,我获得了以下信息:

WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXCCAADDFF to authenticate.
我使用提供的链接代码执行推荐的步骤。大约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
是指设备代码,可能是您启用设备登录造成的

您提到获取提供的帐户xx的错误消息
。yy@company.com无法访问订阅ID…
,您可以使用

Connect-AzAccount -TenantId <tenantId> -Subscription <subscriptionId>
Connect AzAccount-TenantId-Subscription
而不是

Connect-AzAccount -Subscription <subscriptionId>
连接AzaAccount-订阅

对于这个问题,这里有一个与之相关的例子。我也在我这边测试它,只需添加
-TenantId
,它将解决错误消息。

对于cmdlet,您是否向它传递了任何凭据?不,我只使用
连接AzaAccount
,然后收到消息
警告:登录,使用web浏览器打开页面https://microsoft.com/devicelogin 然后输入代码XXCCAADDFF进行身份验证。
,在浏览中,我按照该消息(链接和代码)中提供的说明进行操作。您是否尝试在不传递
-Subscription
参数的情况下运行
连接AzaAccount
?然后,您可以使用
set-AzContext
cmdlet在PS上下文中设置正确的订阅。