How to change the display name for a Service Principal

Fabrice_MONNIER
New Contributor III

Hi,

I'm trying to change  the displayName for some EntraID managed service principals.

I've tried using the scim API with a PATCH request, I get a HTTP 200 response, but the displayName remains the same.

I tried the same with Databricks managed service principals, but same result: the displayName remains unchanged.

I'm putting below the Powershell script that I'm using, if anyone has an idea, it would be greatly appreciated.

Thanks!

 

 

$spnID = "[SPN_ID]"
$workspaceUrl = "https://[WORKSPACE_URL]/"

$token ="[TOKEN]"

$body = @{
  "schemas"    = @("urn:ietf:params:scim:api:messages:2.0:PatchOp")
  "Operations" = @(
    @{
      op   = "replace"
      path    = "displayName"
      value   = "[NEW_DISPLAY_NAME]"
      }
    
  )
} | ConvertTo-Json -Depth 5

$response = Invoke-WebRequest -Uri "$workspaceUrl/api/2.0/preview/scim/v2/ServicePrincipals/$spnID" `
    -Headers @{
        Authorization = "Bearer $token"
        "Content-Type" = "application/json"
    } `
    -Method Patch `
    -Body $body

Write-Output $response.Content