gpt4 book ai didi

azure - 如何登录 Azure 服务主体

转载 作者:行者123 更新时间:2023-12-03 22:18:07 26 4
gpt4 key购买 nike

  1. Connect-AzureRMAccount 不起作用。我不在乎。我不想经历需要博士学位的过程才能理解为什么 PowerShell 永远不想工作。所以我将使用 Login-AzureRMAccount

  2. 我已遵循文档。当然这还不够,所以我就来了。 https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azurermps-6.6.0

"In order to get the service principal's credentials as the appropriate object, use the Get-Credential cmdlet. This cmdlet will display a dialog box to enter the service principal user ID and password into."

我在哪里可以找到我的用户ID?我按照另一个关于创建 SP 的文档说明进行操作,我所做的就是创建一个应用程序。我在 PowerShell 中获得了 SP 对象,它所做的只是给了我 SP 的 NAME 。

现在我明白了什么是用户 ID。我如何登录?我使用 Login-AzureRmAccountAdd-AzureRMAccount 他们都说

$p = Get-Credential
Add-AzureRmAccount -ServicePrincipal -ApplicationId "XXXXXXXXXX" -Credential $p -TenantId "XXXXXXXXXXX"
Add(/Login)-AzureRmAccount : Parameter set cannot be resolved using the specified named parameters.

最佳答案

尝试以下命令以服务主体身份登录,它在我这边运行良好。

$azureAplicationId ="Azure AD Application Id"
$azureTenantId= "Your Tenant Id"
$azurePassword = ConvertTo-SecureString "strong password" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential($azureAplicationId , $azurePassword)
Add-AzureRmAccount -Credential $psCred -TenantId $azureTenantId -ServicePrincipal

enter image description here

更多详情请引用此similar issue .

关于azure - 如何登录 Azure 服务主体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51719507/

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