如何登录到 Azure 服务主体
How to log in to Azure service principal
Connect-AzureRMAccount
不起作用。我不在乎。我不想 运行 通过需要博士学位的过程来理解为什么 PowerShell 永远不想工作。所以我要使用 Login-AzureRMAccount
我已按照文档进行操作。当然这还不够,所以我来了。
https://docs.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 的名称。
现在我明白什么是用户 ID 了。我如何登录?我使用 Login-AzureRmAccount
和 Add-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.
您所说的 userId 是您的服务主体的 Application Id(也称为 ClientID)。
以下确实适合您
$pscredential = Get-Credential
Connect-AzureRmAccount -ServicePrincipal -ApplicationId "http://my-app" -Credential $pscredential -TenantId $tenantid
尝试以下命令以服务主体身份登录,我这边运行良好。
$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
更多详细信息,请参阅此。
Connect-AzureRMAccount
不起作用。我不在乎。我不想 运行 通过需要博士学位的过程来理解为什么 PowerShell 永远不想工作。所以我要使用Login-AzureRMAccount
我已按照文档进行操作。当然这还不够,所以我来了。 https://docs.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 的名称。
现在我明白什么是用户 ID 了。我如何登录?我使用 Login-AzureRmAccount
和 Add-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.
您所说的 userId 是您的服务主体的 Application Id(也称为 ClientID)。
以下确实适合您
$pscredential = Get-Credential
Connect-AzureRmAccount -ServicePrincipal -ApplicationId "http://my-app" -Credential $pscredential -TenantId $tenantid
尝试以下命令以服务主体身份登录,我这边运行良好。
$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
更多详细信息,请参阅此