![](/img/trans.png)
[英]How do I retrieve what application/servicePrincipal a user is allowed access to from AzureAD Graph API?
[英]Graph API is removing certificates from my Enterprise Application in AzureAD
當我從 Powershell 腳本調用 graphAPI 時,它首先從 Azure AD 中的企業應用程序服務主體中刪除所有 keyCredentials(證書),然后上傳我的自定義證書。 如何保留當前安裝在應用程序上的證書,並在非活動 state 中上傳我的新證書?
這里是身體。
{
"keyCredentials": [
{
"customKeyIdentifier":
"endDateTime":
"keyId":
"startDateTime":
"type": "X509CertAndPassword",
"usage": "Sign",
"key":
"displayName":
},
{
"customKeyIdentifier":
"endDateTime":
"keyId":
"startDateTime":
"type": "AsymmetricX509Cert",
"usage": "Verify",
"key":
"displayName":
}
],
"passwordCredentials": [
{
"customKeyIdentifier":
"keyId":
"endDateTime":
"startDateTime":
"secretText":
}
]
}'
每個鍵都有一個值,我只是為了隱私而刪除它們。
這是對graphAPI的調用
$response = Invoke-RestMethod -Method Patch -Uri "https://graph.microsoft.com/v1.0/servicePrincipals/{AppID}" -Headers $global:Header -Body $certBody
所有信息都是正確的,因為它正確上傳了自定義證書。 我只是希望它不理會其他證書。
使用addKey而不是 Update 方法來添加額外的 keyCredentials:
POST /servicePrincipals/{id}/addKey
與PATCH /servicePrincipals/{id}
但請注意:
沒有任何現有有效證書(即:尚未添加任何證書,或所有證書已過期)的 ServicePrincipal 將無法使用此服務操作。 更新 servicePrincipal 可用於執行更新。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.