0

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"     }   } }
june alex
  • 244
  • 4
  • 17

1 Answers1

1

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.

Shiva Keshav Varma
  • 3,398
  • 2
  • 9
  • 13