【发布时间】:2020-02-05 02:04:24
【问题描述】:
我有一个使用以下 powershell 创建的服务主体。
$sp3 = New-AzureRmADServicePrincipal `
-DisplayName "<service-principal-name>" `
-CertValue $certValue3 `
-EndDate ([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($cert3.Certificate.GetExpirationDateString(), [System.TimeZoneInfo]::Local.Id, 'GMT Standard Time'))
其中certValue3 是 Base64String RawCertData。此服务主体工作正常,我可以在使用证书时获得令牌。
在 Azure AD 中创建服务主体后,如何使用 Powershell 查看与服务主体关联的证书指纹?
我尝试过this,但是当我尝试执行 Get-AzureADApplicationKeyCredential 时得到Forbidden
我还在 Azure Active Directory 下创建的服务主体下检查了 Azure 门户中的清单 → 应用注册 → keyCredentials 节点为空
"keyCredentials": [],
请注意,当我使用New-AzureRmADApplication 后跟凭据New-AzureRmADAppCredential 和New-AzureRmADServicePrincipal 创建应用程序时,我会看到keyCredentials 与customKeyIdentifier 设置为证书指纹。下面的示例脚本 -
$adapp = New-AzureRmADApplication -DisplayName "<application-name>" `
-HomePage "<home-page-url>" `
-IdentifierUris "<identifier-url>" `
-CertValue $certValue `
-StartDate ([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($cert.Certificate.GetEffectiveDateString(), [System.TimeZoneInfo]::Local.Id, 'GMT Standard Time')) `
-EndDate ([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($cert.Certificate.GetExpirationDateString(), [System.TimeZoneInfo]::Local.Id, 'GMT Standard Time'))
New-AzureRmADAppCredential -ApplicationId $adapp.ApplicationId -CertValue $certValue2
$sp2 = New-AzureRmADServicePrincipal -ApplicationId $adapp.ApplicationId -DisplayName "<application-name>"
在没有 AzureRmADApplication 和 AzureRmADAppCredential 的情况下独立创建服务主体时,如何使用 powershell 获取与 Azure AD 中的服务主体关联的证书的指纹?
【问题讨论】:
-
哦,这很有趣。您是否尝试过通过例如检查 SP 对象?图形资源管理器? Https://aka.ms/ge
-
@juunas,是的,虽然我无法让 Graph Explorer 工作。当我调用它时,我总是得到一个空的应用程序列表。所以我无法进一步挖掘特定的应用程序。 ://
-
您是否尝试获取 /servicePrincipals/the-objectId-from-first-command?我的意思是 PowerShell 命令应该告诉你 id
-
是的,
https://graph.microsoft.com/beta/serviceprincipals/也给了我空列表:(。我可以看到信息(或没有信息)的唯一地方是在清单页面上。
标签: azure powershell azure-active-directory