servicePrincipal resource type

Namespace: microsoft.graph

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.

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 createdObjects directoryObject collection Get a createdObject object collection.
List ownedObjects directoryObject collection Get a ownedObject object collection.
Get delta servicePrincipal collection Get incremental changes for service principals.
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 to a servicePrincipal.
Remove password passwordCredential Remove a password 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 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 group, directory role, 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 and directory roles that this service principal is a member of.
Owners
List owners directoryObject collection Get a owner object collection.
Add owner directoryObject Create a new owner by posting to the owners collection.
Remove owner None Remove an owner from a serviceprincipal.
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.

Properties

Property Type Description
accountEnabled Boolean true if the service principal account is enabled; otherwise, false.
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.
appDisplayName String The display name exposed by the associated application.
appId String The unique identifier for the associated application (its appId property).
applicationTemplateId String Unique identifier of the applicationTemplate that the servicePrincipal was created from. Read-only.
appOwnerOrganizationId String Contains the tenant id where the application is registered. This is applicable only to service principals backed by applications.
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.
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.
deletedDateTime DateTimeOffset The date and time the service principal was deleted. Read-only.
displayName String The display name for the service principal.
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.
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 Azure AD apps.
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 OpenId Connect front-channel, back-channel or SAML logout protocols.
oauth2PermissionScopes 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.
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.
passwordCredentials passwordCredential collection The collection of password credentials associated with the service principal. 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.
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 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.
servicePrincipalType String Identifies if the service principal represents an application or a managed identity. This is set by Azure AD 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.
tags String collection Custom strings that can be used to categorize and identify the service principal. 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.
verifiedPublisher verifiedPublisher Specifies the verified publisher of the application which this service principal represents.

Relationships

Relationship Type Description
appRoleAssignedTo appRoleAssignment Principals (users, groups, and service principals) that are assigned to this service principal. Read-only.
appRoleAssignments appRoleAssignment collection Applications that this service principal is assigned to. Read-only. Nullable.
claimsMappingPolicies claimsMappingPolicy collection The claimsMappingPolicies assigned to this service principal.
createdObjects directoryObject collection Directory objects created by this service principal. Read-only. Nullable.
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.
memberOf directoryObject collection Roles that this service principal is a member of. HTTP Methods: GET Read-only. Nullable.
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.
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.
tokenIssuancePolicies tokenIssuancePolicy collection The tokenIssuancePolicies assigned to this service principal.
tokenLifetimePolicies tokenLifetimePolicy collection The tokenLifetimePolicies assigned to this service principal.

JSON representation

Here is a JSON representation of the resource

{
  "accountEnabled": true,
  "addIns": [{"@odata.type": "microsoft.graph.addIn"}],
  "alternativeNames": ["string"] ,
  "appDisplayName": "string",
  "appId": "string",
  "appOwnerOrganizationId": "guid",
  "appRoleAssignmentRequired": true,
  "appRoles": [{"@odata.type": "microsoft.graph.appRole"}],
  "displayName": "string",
  "homepage": "string",
  "id": "string (identifier)",
  "info": {"@odata.type": "microsoft.graph.informationalUrl"},
  "keyCredentials": [{"@odata.type": "microsoft.graph.keyCredential"}],
  "logoutUrl": "string",
  "oauth2PermissionScopes": [{"@odata.type": "microsoft.graph.permissionScope"}],
  "passwordCredentials": [{"@odata.type": "microsoft.graph.passwordCredential"}],
  "replyUrls": ["string"],
  "servicePrincipalNames": ["string"],
  "servicePrincipalType": "string",
  "tags": ["string"],
  "tokenEncryptionKeyId": "String",
  "verifiedPublisher": {"@odata.type": "microsoft.graph.verifiedPublisher"}
}