【发布时间】:2020-07-01 07:47:18
【问题描述】:
我正在使用 New-AzureADApplicationKeyCredential 为应用程序创建 KeyCredential。 document
首先,我对指纹进行base64编码
$cer = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cer.Import("C:\Users\PFuller\Desktop\abc.cer")
...
$bin = $cer.GetCertHash()
$base64Thumbprint = [System.Convert]::ToBase64String($bin)
...
New-AzureADApplicationKeyCredential -ObjectId <id>
-CustomKeyIdentifier $base64Thumbprint
-Type AsymmetricX509Cert
-Usage Verify -Value $base64Value
但 AAD 清单上的结果是双 base64 编码:
"keyCredentials": [
{
"customKeyIdentifier": "base64(base64Thumbprint)",
...
}
],
根据Microsoft identity platform application authentication certificate credentials
customKeyIdentifier 应该只base64 编码一次并存储在清单的 keyCredentials 上。
我是不是误用了这个 cmd 或者这里出了什么问题?因为在我将清单转换为 base64 编码一次后,一切正常。
感谢您的帮助。
【问题讨论】:
-
嗨,我的回答有用吗?如果您有任何更新,请告诉我:)
标签: c# azure powershell azure-active-directory