gpt4 book ai didi

powershell - Login-AzureRmAccount 无法使用 PSCredential 登录 Azure

转载 作者:行者123 更新时间:2023-12-03 01:50:00 31 4
gpt4 key购买 nike

我正在尝试通过脚本以非交互方式登录我的 Azure 帐户。我只是不知道为什么会失败:

$secpasswd = ConvertTo-SecureString "P@$$W0rd" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2f5c4c5d465f5b1e1d1c1b6f405a5b43404044014c4042" rel="noreferrer noopener nofollow">[email protected]</a>", $secpasswd)

Login-AzureRmAccount -Credential $cred

这是我收到的错误:

Login-AzureRmAccount : Sequence contains no elements

有人可以帮我解决这个问题吗?

谢谢

最佳答案

Atf 的回答有一定道理,但这不仅仅是问题所在。我们无法使用 Hotmail 或 Outlook 帐户直接非交互式登录。您必须使用您帐户的域名才能登录。

请参阅服务器故障中发布的类似问题:https://serverfault.com/questions/746557/add-azureaccount-unknown-user-type-unknown-user-type-on-azure-automation/746673

它提到:

Make sure the credential asset name (not username) is a simple string. Also make sure the credential asset username is a valid OrgID user (ex: [email protected]), not a Microsoft / Live account ([email protected]).

关于powershell - Login-AzureRmAccount 无法使用 PSCredential 登录 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39657391/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com