gpt4 book ai didi

powershell - Login-AzureRmAccount -ServicePrincipal 上没有证书错误

转载 作者:行者123 更新时间:2023-12-03 05:58:19 27 4
gpt4 key购买 nike

我利用 ARM 模板自动化了几个步骤来进行 Java/Tomcat 部署,但在通过证书自动登录方面没有取得成功。

我已使用 OpenSSL 为虚构域“project.company.com”创建了自签名证书。按照本文在 AD 中设置应用程序和具有贡献者角色的服务主体后, https://azure.microsoft.com/en-us/documentation/articles/resource-group-authenticate-service-principal/#provide-certificate-through-automated-powershell-script

我收到错误

“Login-AzureRmAccount:在证书存储中找不到带有指纹 xxxxxxxxxxxxxxxxxxx 的证书”,如下所示。

看起来我在 Azure 订阅级别缺少一些内容。这些具体步骤适用于 Linux 环境中的 Azure CLI,但不适用于 Windows 环境中的 Azure PowerShell。

$cert = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @("<my-path>/project.company.pfx", "<my-password>")

#$applicationId="xxxxxxxxxxxxxxxxxxxxx"
#$tenantId="dddddddddddddddddddddd"
#$subscriptionId="yyyyyyyyyyyyyyyyyyy"
#Login-AzureRmAccount -CertificateThumbprint $cert.Thumbprint -ApplicationId $applicationId -ServicePrincipal -TenantId $tenantId

$azureAdApplication = Get-AzureRmADApplication -IdentifierUri "https://project.company.com"
$subscription = Get-AzureRmSubscription
Login-AzureRmAccount -CertificateThumbprint $cert.Thumbprint -ApplicationId $azureAdApplication.ApplicationId -ServicePrincipal -TenantId $subscription.TenantId

最佳答案

为了让 Azure cmdlet 检测到正确的证书,您需要将公共(public)证书(.cer 文件)安装到受信任的根证书颁发机构存储中。

关于powershell - Login-AzureRmAccount -ServicePrincipal 上没有证书错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37122177/

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