Update servicePrincipal

Namespace: microsoft.graph


APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Update the properties of servicePrincipal object.


Using PATCH to set passwordCredential is not supported. Use the addPassword and removePassword methods to update the password for a servicePrincipal.


One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Application.ReadWrite.All, Directory.ReadWrite.All, Directory.AccessAsUser.All
Delegated (personal Microsoft account) Not supported.
Application Application.ReadWrite.OwnedBy, Application.ReadWrite.All, Directory.ReadWrite.All

HTTP request

PATCH /servicePrincipals/{id}

Request headers

Name Description
Authorization Bearer {token}. Required.
Content-Type application/json. Required.

Request body

In the request body, supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance you shouldn't include existing values that haven't changed.

Property Type Description
accountEnabled Boolean true if the service principal account is enabled; otherwise, false.
addIns addIn Defines custom behavior that a consuming service can use to call an app in specific contexts. For example, applications that can render file streams may set the addIns property for its "FileHandler" functionality. This will let services like Microsoft 365 call the application in the context of a document the user is working on.
alternativeNames String collection Used to retrieve service principals by subscription, identify resource group and full resource ids for managed identities.
appRoleAssignmentRequired Boolean Specifies whether an appRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. Not nullable.
appRoles appRole collection The application roles exposed by the associated application. For more information see the appRoles property definition on the application resource. Not nullable.
displayName String The display name for the service principal.
homepage String Home page or landing page of the application.
keyCredentials keyCredential collection The collection of key credentials associated with the service principal. Not nullable.
loginUrl String Specifies the URL where the service provider redirects the user to Azure AD to authenticate. Azure AD uses the URL to launch the application from Microsoft 365 or the Azure AD My Apps. When blank, Azure AD performs IdP-initiated sign-on for applications configured with SAML-based single sign-on. The user launches the application from Microsoft 365, the Azure AD My Apps, or the Azure AD SSO URL.
logoutUrl String Specifies the URL that will be used by Microsoft's authorization service to logout an user using front-channel, back-channel or SAML logout protocols.
notificationEmailAddresses String collection Specifies the list of email addresses where Azure AD sends a notification when the active certificate is near the expiration date. This is only for the certificates used to sign the SAML token issued for Azure AD Gallery applications.
publishedPermissionScopes permissionScope collection The OAuth 2.0 permissions exposed by the associated application. For more information see the oauth2PermissionScopes property definition on the application resource. Not nullable.
preferredSingleSignOnMode string Specifies the single sign-on mode configured for this application. Azure AD uses the preferred single sign-on mode to launch the application from Microsoft 365 or the Azure AD My Apps. The supported values are password, saml, external, and oidc.
preferredTokenSigningKeyEndDateTime DateTimeOffset Specifies the expiration date of the keyCredential used for token signing, marked by preferredTokenSigningKeyThumbprint.
preferredTokenSigningKeyThumbprint String Reserved for internal use only. Do not write or otherwise rely on this property. May be removed in future versions.
publisherName String The display name of the tenant in which the associated application is specified.
replyUrls String collection The URLs that user tokens are sent to for sign in with the associated application, or the redirect URIs that OAuth 2.0 authorization codes and access tokens are sent to for the associated application. Not nullable.
samlSingleSignOnSettings samlSingleSignOnSettings The collection for settings related to saml single sign-on.
servicePrincipalNames String collection Contains the list of identifiersUris, copied over from the associated application. Additional values can be added to hybrid applications. These values can be used to identify the permissions exposed by this app within Azure AD. For example,
  • Client apps requesting permissions to this resource can use these URIs to specify needed permissions in the requiredResourceAccess property of their application manifest, or in the "API permissions" blade on the App registrations experience.
  • Client apps can specify a resource URI which is based on the values of this property to acquire an access token, which is the URI returned in the “aud” claim.

The any operator is required for filter expressions on multi-valued properties. Not nullable.
tags String collection Not nullable.
tokenEncryptionKeyId String Specifies the keyId of a public key from the keyCredentials collection. When configured, Azure AD issues tokens for this application encrypted using the key specified by this property. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user.


If successful, this method returns a 204 No Content response code and updated servicePrincipal object in the response body.



Here is an example of the request.

PATCH https://graph.microsoft.com/beta/servicePrincipals/{id}
Content-type: application/json
Content-length: 391

  "appRoleAssignmentRequired": true


Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 204 No Content