Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

microsoft graph api - how to set the service principle display name in azure active directory

I am trying to create a service principle in using Microsoft graph API. Following the document i refereed create service principle. I just want to identify the service principle that created through graph API. So i just add display name in graph API body.Below is my service principle Json body.

$RESOURCE_GROUP = "TESTRG"
POST https://graph.microsoft.com/v1.0/servicePrincipals
Content-type: application/json

{
  "appId": "65415bb1-9267-4313-bbf5-ae259732ee12",
     "displayName": "' + $RESOURCE_GROUP + "-" + $appId + '",

}

it returns an error message

{   "error": {     "code": "Request_BadRequest",     "message": "Property displayName on the service principal does not match the application
     | object.",     "innerError": {       "date": "2021-01-24T07:33:25",       "request-id": "80792870-6524-4373-434342-434343",      
     | "client-request-id": "80792870-6524-4373-434342-434343"     }   } }
question from:https://stackoverflow.com/questions/65868183/how-to-set-the-service-principle-display-name-in-azure-active-directory

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here you need to make sure first you update the App displayName which you give for service principal and later update the service principal with the same displayName. Basically the servicePrinipal object validates its properties with the respective Application object. I have tested it in POSTMAN and found that it requires to update the display name on App object and later on Service Principal. Please check the below screenshots.

Update App object with new name PostmanGraphs:

enter image description here

Update Service Principal object with new name PostmanGraphs:

enter image description here

When an app object gets registered in AAD it creates a service principal automatically. See this document.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...