Add-AzureRmAccount :序列不包含任何元素(也不适用于 Gmail 帐户)
Add-AzureRmAccount : Sequence contains no element (Not working for Gmail accounts too)
我已经使用我的个人电子邮件 ID 创建了一个 'Free Trial' 帐户,它是一个 Gmail ID。我收到错误:
Add-AzureRmAccount : Sequence contains no elements At line:1 char:1
+ Add-AzureRmAccount -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzureRmAccount], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.AddAzureRMAccountCommand
我 运行 的代码是
$username = "abc@gmail.com"
$password = "something"
$secpass = $password | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secpass
Add-AzureRmAccount -Credential $cred
是否有某种类型的 accounts/subscriptions 可以像这样登录?
Windows Live ID 凭据不能用于非交互式登录。此错误消息被描述为 this issue 的一部分,已提出,因为它需要改进。
我认为您需要使用 Login-AzureRmAccount
以交互方式登录,或者根据本指南创建用于登录的服务主体:https://docs.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azurermps-4.2.0
Log in with a service principal
Service principals provide a way for you to create non-interactive
accounts that you can use to manipulate resources. Service principals
are like user accounts to which you can apply rules using Azure Active
Directory. By granting the minimum permissions needed to a service
principal, you can ensure your automation scripts are even more
secure.
If you don't already have a service principal, create one.
Log in with the service principal:
Login-AzureRmAccount -ServicePrincipal -ApplicationId "http://my-app" -Credential $pscredential -TenantId $tenantid
我已经使用我的个人电子邮件 ID 创建了一个 'Free Trial' 帐户,它是一个 Gmail ID。我收到错误:
Add-AzureRmAccount : Sequence contains no elements At line:1 char:1 + Add-AzureRmAccount -Credential $cred + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Add-AzureRmAccount], AadAuthenticationFailedException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.AddAzureRMAccountCommand
我 运行 的代码是
$username = "abc@gmail.com"
$password = "something"
$secpass = $password | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secpass
Add-AzureRmAccount -Credential $cred
是否有某种类型的 accounts/subscriptions 可以像这样登录?
Windows Live ID 凭据不能用于非交互式登录。此错误消息被描述为 this issue 的一部分,已提出,因为它需要改进。
我认为您需要使用 Login-AzureRmAccount
以交互方式登录,或者根据本指南创建用于登录的服务主体:https://docs.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azurermps-4.2.0
Log in with a service principal
Service principals provide a way for you to create non-interactive accounts that you can use to manipulate resources. Service principals are like user accounts to which you can apply rules using Azure Active Directory. By granting the minimum permissions needed to a service principal, you can ensure your automation scripts are even more secure.
If you don't already have a service principal, create one.
Log in with the service principal:
Login-AzureRmAccount -ServicePrincipal -ApplicationId "http://my-app" -Credential $pscredential -TenantId $tenantid