servicePrincipal resource type

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Represents an instance of an application in a directory. Inherits from directoryObject.

This resource supports using delta query to track incremental additions, deletions, and updates, by providing a delta function. This resource is an open type that allows other properties to be passed in.

Methods

Method Return Type Description
List servicePrincipals servicePrincipal collection Retrieve a list of servicePrincipal objects.
Create servicePrincipal servicePrincipal Creates a new servicePrincipal object.
Get servicePrincipal servicePrincipal Read properties and relationships of servicePrincipal object.
Update servicePrincipal servicePrincipal Update servicePrincipal object.
Delete servicePrincipal None Delete servicePrincipal object.
List deleted servicePrincipals directoryObject collection Retrieve a list of recently deleted servicePrincipal objects.
Get deleted servicePrincipal directoryObject Retrieve the properties of a recently deleted servicePrincipal object.
Permanently delete servicePrincipal None Permanently delete a servicePrincipal object.
Restore deleted servicePrincipal directoryObject Restore a recently deleted servicePrincipal object.
List createdObjects directoryObject collection Get a createdObject object collection.
List ownedObjects directoryObject collection Get an ownedObject object collection.
delta servicePrincipal collection Get incremental changes for service principals.
Create remoteDesktopSecurityConfiguration remoteDesktopSecurityConfiguration Create a new remoteDesktopSecurityConfiguration object on the servicePrincipal.
Get remoteDesktopSecurityConfiguration remoteDesktopSecurityConfiguration Get the remoteDesktopSecurityConfiguration object on the servicePrincipal.
Delete remoteDesktopSecurityConfiguration None Delete a remoteDesktopSecurityConfiguration object on a servicePrincipal.
App role assignments
List appRoleAssignments appRoleAssignment collection Get the app roles, which this service principal has been assigned.
Add appRoleAssignment appRoleAssignment Assign an app role to this service principal.
Remove appRoleAssignment None Remove an app role assignment from this service principal.
List appRoleAssignedTo appRoleAssignment collection Get the users, groups, and service principals assigned app roles for this service principal.
Add appRoleAssignedTo appRoleAssignment Assign an app role for this service principal to a user, group, or service principal.
Remove appRoleAssignedTo None Remove an app role assignment for this service principal from a user, group, or service principal.
Certificates and secrets
Add password passwordCredential Add a strong password or secret to a servicePrincipal.
Add tokenSigningCertificate selfSignedCertificate Add a self signed certificate to the service principal. Mostly use for configuring SAML based SSO applications from the Microsoft Entra gallery.
Remove password passwordCredential Remove a password or secret from a servicePrincipal.
Add key keyCredential Add a key credential to a servicePrincipal.
Remove key None Remove a key credential from a servicePrincipal.
Delegated permission classifications
List delegated permission classifications delegatedPermissionClassification collection Get the permission classifications for delegated permissions exposed by this service principal.
Add delegated permission classification delegatedPermissionClassification Add a permission classification for a delegated permission exposed by this service principal.
Remove delegated permission classification None Remove a permission classification for a delegated permission exposed by this service principal.
Delegated permission grants
List oauth2PermissionGrants oAuth2PermissionGrant collection Get the delegated permission grants authorizing this service principal to access an API on behalf of a signed-in user.
Membership
List memberOf directoryObject collection Get the groups that this service principal is a direct member of from the memberOf navigation property.
List transitive memberOf directoryObject collection List the groups that this service principal is a member of. This operation is transitive and includes the groups that this service principal is a nested member of.
checkMemberGroups String collection Check for membership in a specified list of groups.
checkMemberObjects String collection Check for membership in a specified list of groups, directory roles, or administrative unit objects.
getMemberGroups String collection Get the list of groups that this service principal is a member of.
getMemberObjects String collection Get the list of groups, administrative units, and directory roles that this service principal is a member of.
Owners
List owners directoryObject collection Get the owners of a service principal.
Add owner directoryObject Assign an owner to a service principal. Service principal owners can be users or other service principals.
Remove owner None Remove an owner from a service principal. As a recommended best practice, service principals should have at least two owners.
Policies
Assign claimsMappingPolicy claimsMappingPolicy collection Assign a claimsMappingPolicy to this object.
List claimsMappingPolicies claimsMappingPolicy collection Get all claimsMappingPolicies assigned to this object.
Remove claimsMappingPolicy claimsMappingPolicy collection Remove a claimsMappingPolicy from this object.
Assign homeRealmDiscoveryPolicy homeRealmDiscoveryPolicy collection Assign a homeRealmDiscoveryPolicy to this object.
List homeRealmDiscoveryPolicies homeRealmDiscoveryPolicy collection Get all homeRealmDiscoveryPolicies assigned to this object.
Remove homeRealmDiscoveryPolicy homeRealmDiscoveryPolicy collection Remove a homeRealmDiscoveryPolicy from this object.
Assign tokenIssuancePolicy tokenIssuancePolicy collection Assign a tokenIssuancePolicy to this object.
List tokenIssuancePolicies tokenIssuancePolicy collection Get all tokenIssuancePolicies assigned to this object.
Remove tokenIssuancePolicy tokenIssuancePolicy collection Remove a tokenIssuancePolicy from this object.
Assign tokenLifetimePolicy tokenLifetimePolicy collection Assign a tokenLifetimePolicy to this object.
List tokenLifetimePolicies tokenLifetimePolicy collection Get all tokenLifetimePolicies assigned to this object.
Remove tokenLifetimePolicy tokenLifetimePolicy collection Remove a tokenLifetimePolicy from this object.
List permissionGrantPreApprovalPolicy permissionGrantPreApprovalPolicy collection Get permissionGrantPreApprovalPolicy assigned to this object.
Assign permissionGrantPreApprovalPolicy permissionGrantPreApprovalPolicy collection Assign a permissionGrantPreApprovalPolicy to this object.
Remove permissionGrantPreApprovalPolicy permissionGrantPreApprovalPolicy collection Remove a permissionGrantPreApprovalPolicy from this object.
Single sign on
createPasswordSingleSignOnCredentials passwordSingleSignOnCredentialSet Create a credential set for the user or group specified in the body.
getPasswordSingleSignOnCredentials passwordSingleSignOnCredentialSet Get a credential set for the user or group specified in the body.
updatePasswordSingleSignOnCredentials None Update a credential set for the user or group specified in the body.
deletePasswordSingleSignOnCredentials None Delete a credential set for the user or group specified in the body.

Properties

Important

Specific usage of $filter and the $search query parameter is supported only when you use the ConsistencyLevel header set to eventual and $count. For more information, see Advanced query capabilities on directory objects.

Property Type Description
accountEnabled Boolean true if the service principal account is enabled; otherwise, false. If set to false, then no users will be able to sign in to this app, even if they are assigned to it. Supports $filter (eq, ne, not, in).
addIns addIn collection 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. Supports $filter (eq, not, ge, le, startsWith).
appDescription String The description exposed by the associated application.
appDisplayName String The display name exposed by the associated application.
appId String The unique identifier for the associated application (its appId property). Alternate key. Supports $filter (eq, ne, not, in, startsWith).
applicationTemplateId String Unique identifier of the applicationTemplate that the servicePrincipal was created from. Read-only. Supports $filter (eq, ne, NOT, startsWith).
appOwnerOrganizationId Guid Contains the tenant id where the application is registered. This is applicable only to service principals backed by applications. Supports $filter (eq, ne, NOT, ge, le).
appRoleAssignmentRequired Boolean Specifies whether users or other service principals need to be granted an app role assignment for this service principal before users can sign in or apps can get tokens. The default value is false. Not nullable.

Supports $filter (eq, ne, NOT).
appRoles appRole collection The roles exposed by the application, which this service principal represents. For more information see the appRoles property definition on the application entity. Not nullable.
customSecurityAttributes customSecurityAttributeValue An open complex type that holds the value of a custom security attribute that is assigned to a directory object. Nullable.

Returned only on $select. Supports $filter (eq, ne, not, startsWith). Filter value is case sensitive.
deletedDateTime DateTimeOffset The date and time the service principal was deleted. Read-only.
description String Free text field to provide an internal end-user facing description of the service principal. End-user portals such MyApps will display the application description in this field. The maximum allowed size is 1024 characters. Supports $filter (eq, ne, not, ge, le, startsWith) and $search.
disabledByMicrosoftStatus String Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).

Supports $filter (eq, ne, not).
displayName String The display name for the service principal. Supports $filter (eq, ne, not, ge, le, in, startsWith, and eq on null values), $search, and $orderby.
errorUrl String Deprecated. Don't use.
homepage String Home page or landing page of the application.
id String The unique identifier for the service principal. Inherited from directoryObject. Key. Not nullable. Read-only. Supports $filter (eq, ne, not, in).
info informationalUrl Basic profile information of the acquired application such as app's marketing, support, terms of service and privacy statement URLs. The terms of service and privacy statement are surfaced to users through the user consent experience. For more info, see How to: Add Terms of service and privacy statement for registered Microsoft Entra apps.

Supports $filter (eq, ne, not, ge, le, and eq on null values).
keyCredentials keyCredential collection The collection of key credentials associated with the service principal. Not nullable. Supports $filter (eq, not, ge, le).
loginUrl String Specifies the URL where the service provider redirects the user to Microsoft Entra ID to authenticate. Microsoft Entra ID uses the URL to launch the application from Microsoft 365 or the Microsoft Entra My Apps. When blank, Microsoft Entra ID performs IdP-initiated sign-on for applications configured with SAML-based single sign-on. The user launches the application from Microsoft 365, the Microsoft Entra My Apps, or the Microsoft Entra SSO URL.
logoutUrl String Specifies the URL that will be used by Microsoft's authorization service to logout an user using OpenId Connect front-channel, back-channel or SAML logout protocols.
notes String Free text field to capture information about the service principal, typically used for operational purposes. Maximum allowed size is 1024 characters.
notificationEmailAddresses String collection Specifies the list of email addresses where Microsoft Entra ID 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 Microsoft Entra Gallery applications.
passwordCredentials passwordCredential collection The collection of password credentials associated with the service principal. Not nullable.
passwordSingleSignOnSettings passwordSingleSignOnSettings The collection for settings related to password single sign-on. Use $select=passwordSingleSignOnSettings to read the property. Read-only for applicationTemplates except for custom applicationTemplates.
preferredSingleSignOnMode string Specifies the single sign-on mode configured for this application. Microsoft Entra ID uses the preferred single sign-on mode to launch the application from Microsoft 365 or the Microsoft Entra My Apps. The supported values are password, saml, notSupported, and oidc.
permissionGrantPreApprovalPolicies permissionGrantPreApprovalPolicy collection The list of pre-approval policies that has been assigned to the service principal.
preferredTokenSigningKeyEndDateTime DateTimeOffset Specifies the expiration date of the keyCredential used for token signing, marked by preferredTokenSigningKeyThumbprint. Updating this attribute is not currentlysupported. For details, see ServicePrincipal property differences.
preferredTokenSigningKeyThumbprint String This property can be used on SAML applications (apps that have preferredSingleSignOnMode set to saml) to control which certificate is used to sign the SAML responses. For applications that are not SAML, do not write or otherwise rely on this property.
publishedPermissionScopes permissionScope collection The delegated permissions exposed by the application. For more information see the oauth2PermissionScopes property on the application entity's api property. Not nullable.
Note: This property is named oauth2PermissionScopes in v1.0.
publisherName String The name of the Microsoft Entra tenant that published the application.
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.
samlMetadataUrl String The url where the service exposes SAML metadata for federation.
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 Microsoft Entra ID. For example,
  • 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.

Supports $filter (eq, not, ge, le, startsWith).
servicePrincipalType String Identifies if the service principal represents an application or a managed identity. This is set by Microsoft Entra ID internally. For a service principal that represents an application this is set as Application. For a service principal that represent a managed identity this is set as ManagedIdentity. The SocialIdp type is for internal use.
signInAudience String Specifies the Microsoft accounts that are supported for the current application. Read-only.

Supported values are:
  • AzureADMyOrg: Users with a Microsoft work or school account in my organization's Microsoft Entra tenant (single-tenant).
  • AzureADMultipleOrgs: Users with a Microsoft work or school account in any organization's Microsoft Entra tenant (multi-tenant).
  • AzureADandPersonalMicrosoftAccount: Users with a personal Microsoft account, or a work or school account in any organization's Microsoft Entra tenant.
  • PersonalMicrosoftAccount: Users with a personal Microsoft account only.
tags String collection Custom strings that can be used to categorize and identify the service principal. Not nullable. The value is the union of strings set here and on the associated application entity's tags property.

Supports $filter (eq, not, ge, le, startsWith).
tokenEncryptionKeyId String Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID 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.
verifiedPublisher verifiedPublisher Specifies the verified publisher of the application which this service principal represents.

Relationships

Important

Specific usage of the $filter query parameter is supported only when you use the ConsistencyLevel header set to eventual and $count. For more information, see Advanced query capabilities on directory objects.

Relationship Type Description
appManagementPolicies appManagementPolicy collection The appManagementPolicy applied to this service principal.
appRoleAssignedTo appRoleAssignment App role assignments for this app or service, granted to users, groups, and other service principals.Supports $expand.
appRoleAssignments appRoleAssignment collection App role assignment for another app or service, granted to this service principal. Supports $expand.
claimsMappingPolicies claimsMappingPolicy collection The claimsMappingPolicies assigned to this service principal. Supports $expand.
createdObjects directoryObject collection Directory objects created by this service principal. Read-only. Nullable.
delegatedPermissionClassifications delegatedPermissionClassification collection The permission classifications for delegated permissions exposed by the app that this service principal represents. Supports $expand.
endpoints endpoint collection Endpoints available for discovery. Services like Sharepoint populate this property with a tenant specific SharePoint endpoints that other applications can discover and use in their experiences.
homeRealmDiscoveryPolicies homeRealmDiscoveryPolicy collection The homeRealmDiscoveryPolicies assigned to this service principal. Supports $expand.
memberOf directoryObject collection Roles that this service principal is a member of. HTTP Methods: GET Read-only. Nullable. Supports $expand.
oauth2PermissionGrants oAuth2PermissionGrant collection Delegated permission grants authorizing this service principal to access an API on behalf of a signed-in user. Read-only. Nullable.
ownedObjects directoryObject collection Directory objects that are owned by this service principal. Read-only. Nullable. Supports $expand and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1).
owners directoryObject collection Directory objects that are owners of this servicePrincipal. The owners are a set of non-admin users or servicePrincipals who are allowed to modify this object. Read-only. Nullable. Supports $expand and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1).
remoteDesktopSecurityConfiguration remoteDesktopSecurityConfiguration The remoteDesktopSecurityConfiguration object applied to this service principal. Supports $filter (eq) for isRemoteDesktopProtocolEnabled property.
synchronization synchronization Represents the capability for Microsoft Entra identity synchronization through the Microsoft Graph API.
tokenIssuancePolicies tokenIssuancePolicy collection The tokenIssuancePolicies assigned to this service principal. Supports $expand.
tokenLifetimePolicies tokenLifetimePolicy collection The tokenLifetimePolicies assigned to this service principal. Supports $expand.

JSON representation

The following JSON representation shows the resource type.

{
  "accountEnabled": true,
  "addIns": [{"@odata.type": "microsoft.graph.addIn"}],
  "alternativeNames": "String",
  "appDisplayName": "String",
  "appId": "String",
  "appOwnerOrganizationId": "Guid",
  "applicationTemplateId": "String",
  "appRoleAssignmentRequired": true,
  "appRoles": [{"@odata.type": "microsoft.graph.appRole"}],
  "customSecurityAttributes": {
    "@odata.type": "microsoft.graph.customSecurityAttributeValue"
  },
  "disabledByMicrosoftStatus": "String",
  "displayName": "String",
  "errorUrl": "String",
  "homepage": "String",
  "id": "String (identifier)",
  "info": {"@odata.type": "microsoft.graph.informationalUrl"},
  "keyCredentials": [{"@odata.type": "microsoft.graph.keyCredential"}],
  "loginUrl": "String",
  "logoutUrl": "String",
  "notes": "String",
  "notificationEmailAddresses": ["String"],
  "publishedPermissionScopes": [{"@odata.type": "microsoft.graph.permissionScope"}],
  "passwordCredentials": [{"@odata.type": "microsoft.graph.passwordCredential"}],
  "passwordSingleSignOnSettings": {"@odata.type": "microsoft.graph.passwordSingleSignOnSettings"},
  "preferredSingleSignOnMode": "String",
  "preferredTokenSigningKeyEndDateTime": "DateTime",
  "preferredTokenSigningKeyThumbprint": "String",
  "publisherName": "String",
  "replyUrls": ["String"],
  "samlMetadataUrl": "String",
  "samlSingleSignOnSettings": "microsoft.DirectoryServices.SamlSingleSignOnSettings",
  "servicePrincipalNames": ["String"],
  "servicePrincipalType": "String",
  "signInAudience": "String",
  "tags": ["String"],
  "tokenEncryptionKeyId": "String",
  "useCustomTokenSigningKey": false,
  "verifiedPublisher": {"@odata.type": "microsoft.graph.verifiedPublisher"}
}