POST
/v1/organizations/{organizationId}/service-principals/{principalId}/grantsCreate a Grant for an Organization-scoped ServicePrincipal
Add one fixed built-in role at an exact scope no wider than the ServicePrincipal's immutable structural scope.
Authentication
Send an API key as a Bearer token in the Authorization header.
Parameters
Request body
Required.
application/jsonResponses
201ServicePrincipalGrantCreatedapplication/json400The request path, headers, query, or JSON body did not satisfy the published schema401Unauthorizedapplication/json403Forbiddenapplication/json404NotFoundapplication/json409Conflictapplication/jsonReusable schemas
ServicePrincipalGrantCreatedEncoded
object- unknown properties allowed
false
grantIdrequiredstringThe Grant identifier.- maximum length
64 - pattern
^grant_[\s\S]+$
- maximum length
principalIdrequiredstringThe Principal identifier.- maximum length
64 - pattern
^principal_[\s\S]+$
- maximum length
rolerequired- MachineGrantRoleThe Organization role granted to the provisioned identity.
scoperequired- PrincipalScopeThe immutable structural scope of this machine identity.
grantedByPrincipalIdrequiredstringThe Principal that created this Grant.- maximum length
64 - pattern
^principal_[\s\S]+$
- maximum length
createdAtrequiredstringWhen the resource was created, in UTC.- format
date-time
- format
expiresAtrequired- When the resource expires, in UTC, or null when it does not expire.
- format
date-time
Any ofstringnull - format
revokedAtrequired- When the resource was revoked, in UTC, or null while it remains active.
- format
date-time
Any ofstringnull - format
UnauthorizedEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"Unauthorized"
- allowed values
reasonrequiredstringA safe explanation of why the credential was rejected.
ForbiddenEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"Forbidden"
- allowed values
permissionrequiredstringThe permission required by the refused operation.
NotFoundEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"NotFound"
- allowed values
resourcerequiredstringThe resource type relevant to the error.idrequiredstringThe identifier supplied for the resource that was not found.
ConflictEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"Conflict"
- allowed values
resourcerequiredstringThe resource type relevant to the error.reasonrequiredstringA safe explanation of the state conflict.
ServicePrincipalGrantCreateRequest
object- unknown properties allowed
false
rolerequired- The Organization role granted to the provisioned identity.All ofThe fixed built-in role this Grant carries.
scoperequired- PrincipalScopeThe immutable structural scope of this machine identity.
expiresAtrequired- When the Grant expires, in UTC, or null when it does not expire.
- format
date-time
Any ofstringnull - format
MachineGrantRole
string- allowed values
"admin", "developer", "viewer", "configurationDeployer"
PrincipalScope
OrganizationScope
object- unknown properties allowed
false
levelrequiredstringThe tenancy level of this structural scope.- allowed values
"organization"
- allowed values
organizationIdrequiredstringThe Organization identifier.- maximum length
64 - pattern
^org_[\s\S]+$
- maximum length
ProjectScope
object- unknown properties allowed
false
levelrequiredstringThe tenancy level of this structural scope.- allowed values
"project"
- allowed values
organizationIdrequiredstringThe Organization identifier.- maximum length
64 - pattern
^org_[\s\S]+$
- maximum length
projectIdrequiredstringThe Project identifier.- maximum length
64 - pattern
^proj_[\s\S]+$
- maximum length
EnvironmentScope
object- unknown properties allowed
false
levelrequiredstringThe tenancy level of this structural scope.- allowed values
"environment"
- allowed values
organizationIdrequiredstringThe Organization identifier.- maximum length
64 - pattern
^org_[\s\S]+$
- maximum length
projectIdrequiredstringThe Project identifier.- maximum length
64 - pattern
^proj_[\s\S]+$
- maximum length
environmentIdrequiredstringThe Environment identifier.- maximum length
64 - pattern
^env_[\s\S]+$
- maximum length
TenantScope
object- unknown properties allowed
false
levelrequiredstringThe tenancy level of this structural scope.- allowed values
"tenant"
- allowed values
organizationIdrequiredstringThe Organization identifier.- maximum length
64 - pattern
^org_[\s\S]+$
- maximum length
projectIdrequiredstringThe Project identifier.- maximum length
64 - pattern
^proj_[\s\S]+$
- maximum length
environmentIdrequiredstringThe Environment identifier.- maximum length
64 - pattern
^env_[\s\S]+$
- maximum length
tenantIdrequiredstringThe Tenant identifier.- maximum length
64 - pattern
^tenant_[\s\S]+$
- maximum length