gpt4 book ai didi

powershell - 无法将凭据添加到 Azure AD 中的服务主体

转载 作者:行者123 更新时间:2023-12-03 00:49:44 24 4
gpt4 key购买 nike

我正在尝试使用以下 powershell 脚本向服务主体(Azure AD 应用程序)添加凭据

connect-msolservice
$cer = New-ObjectSystem.Security.Cryptography.X509Certificates.X509Certificate
$cer.Import($location)
$binCert = $cer.GetRawCertData()
$credValue = [System.Convert]::ToBase64String($binCert);
New-MsolServicePrincipalCredential -AppPrincipalId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -Type asymmetric -Value $credValue -Usage verify

但是我收到以下错误:访问被拒绝。您无权调用此应用程序。

我不是此应用程序的所有者,但实际所有者已使我成为所有者之一。
对于我创建的另一个应用程序,上面的代码运行顺利。我错过了什么吗?我需要任何其他身份验证机制吗?

最佳答案

只有租户的全局管理员才有权在该租户中创建或更新服务主体。

作为此应用程序的所有者,您想要添加新凭据的方法是通过应用程序 list 更新应用程序对象。

此处有有关将 X509 添加到应用程序对象的说明(在为应用程序配置 X.509 公共(public)证书部分中): http://blogs.msdn.com/b/exchangedev/archive/2015/01/21/building-demon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow.aspx

如果您被标记为所有者,您应该有权访问和更新应用程序的这一部分。

请注意,此处的证书是全局证书,可用于在任何租户的上下文中进行身份验证,而不是服务主体上的租户特定证书。

希望这会有所帮助!

关于powershell - 无法将凭据添加到 Azure AD 中的服务主体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32176560/

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