v1

latestSwagger 2.02026-07-135658136.3 KB
OAuth2PermissionGrant_Create

Grants OAuth2 permissions for the relevant resource Ids of an app.

post/{tenantID}/oauth2PermissionGrants

Path parameters

tenantIDstring required

The tenant ID.

Query parameters

api-versionstring required

Client API version.

Request body

odata.typestring

Microsoft.DirectoryServices.OAuth2PermissionGrant

clientIdstring

The id of the resource's service principal granted consent to impersonate the user when accessing the resource (represented by the resourceId property).

objectIdstring

The id of the permission grant

consentType'AllPrincipals' | 'Principal'

Indicates if consent was provided by the administrator (on behalf of the organization) or by an individual.

principalIdstring

When consent type is Principal, this property specifies the id of the user that granted consent and applies only for that user.

resourceIdstring

Object Id of the resource you want to grant

scopestring

Specifies the value of the scope claim that the resource application should expect in the OAuth 2.0 access token. For example, User.Read

startTimestring

Start time for TTL

expiryTimestring

Expiry time for TTL

Example request

{
  "odata.type": "odata.type",
  "resourceId": "resourceId",
  "clientId": "clientId",
  "scope": "scope",
  "expiryTime": "expiryTime",
  "consentType": "consentType",
  "principalId": "",
  "startTime": "startTime"
}

Response

OK. The operation was successful.

odata.typestring

Microsoft.DirectoryServices.OAuth2PermissionGrant

clientIdstring

The id of the resource's service principal granted consent to impersonate the user when accessing the resource (represented by the resourceId property).

objectIdstring

The id of the permission grant

consentType'AllPrincipals' | 'Principal'

Indicates if consent was provided by the administrator (on behalf of the organization) or by an individual.

principalIdstring

When consent type is Principal, this property specifies the id of the user that granted consent and applies only for that user.

resourceIdstring

Object Id of the resource you want to grant

scopestring

Specifies the value of the scope claim that the resource application should expect in the OAuth 2.0 access token. For example, User.Read

startTimestring

Start time for TTL

expiryTimestring

Expiry time for TTL

Example response

{
  "odata.type": "odata.type",
  "resourceId": "resourceId",
  "clientId": "clientId",
  "scope": "scope",
  "expiryTime": "expiryTime",
  "consentType": "consentType",
  "principalId": "",
  "startTime": "startTime"
}