You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assign a Entra ID role to a user and specify the scope for which the user has been granted access
Options
ption
Description
--roleDefinitionId [roleDefinitionId]
Id of a role to be assigned. Specify either roleDefinitionId or roleDefinitionName, but not both.
--roleDefinitionName [roleDefinitionName]
Name of a role to be assigned. Specify either roleDefinitionId or roleDefinitionName, but not both.
--principalId [principalId]
Id of a user to which the assignment is granted. Specify either principalId or principalName, but not both.
--principalName [principalName]
User principal name of a user to which the assignment is granted. Specify either principalId or principalName, but not both.
-s, --scope <scope>
Scope of the role assignment. Allowed values are: tenant, administrativeUnit, application, servicePrincipal.
--administrativeUnitId [administrativeUnitId]
Id of an administrative unit to which the assignment is scoped. Specify either administrativeUnitId or administrativeUnitName when scope is set to administrativeUnit.
--administrativeUnitName [administrativeUnitName]
Name of an administrative unit to which the assignment is scoped. Specify either administrativeUnitId or administrativeUnitName when scope is set to administrativeUnit.
--applicationId [applicationId]
Id of an application to which the assignment is scoped. Specify either applicationId or applicationName when scope is set to application.
--applicationName [applicationName]
Name of an application to which the assignment is scoped. Specify either applicationId or applicationName when scope is set to application.
--servicePrincipalId [servicePrincipalId]
Id of an application to which the assignment is scoped. Specify either servicePrincipalId or servicePrincipalName when scope is set to servicePrincipal.
--servicePrincipalName [servicePrincipalName]
Name of an application to which the assignment is scoped. Specify either servicePrincipalId or servicePrincipalName when scope is set to servicePrincipal.
Examples
Assign a role specified by name to a user specified by id and scope the assignment to the whole tenant
Usage
m365 entra roleassignment add [options]
Description
Assign a Entra ID role to a user and specify the scope for which the user has been granted access
Options
--roleDefinitionId [roleDefinitionId]
roleDefinitionId
orroleDefinitionName
, but not both.--roleDefinitionName [roleDefinitionName]
roleDefinitionId
orroleDefinitionName
, but not both.--principalId [principalId]
principalId
orprincipalName
, but not both.--principalName [principalName]
principalId
orprincipalName
, but not both.-s, --scope <scope>
tenant
,administrativeUnit
,application
,servicePrincipal
.--administrativeUnitId [administrativeUnitId]
administrativeUnitId
oradministrativeUnitName
when scope is set toadministrativeUnit
.--administrativeUnitName [administrativeUnitName]
administrativeUnitId
oradministrativeUnitName
when scope is set toadministrativeUnit
.--applicationId [applicationId]
applicationId
orapplicationName
when scope is set toapplication
.--applicationName [applicationName]
applicationId
orapplicationName
when scope is set toapplication
.--servicePrincipalId [servicePrincipalId]
servicePrincipalId
orservicePrincipalName
when scope is set toservicePrincipal
.--servicePrincipalName [servicePrincipalName]
servicePrincipalId
orservicePrincipalName
when scope is set toservicePrincipal
.Examples
Assign a role specified by name to a user specified by id and scope the assignment to the whole tenant
m365 entra roleassignment add --roleDefinitionName 'SharePoint Administrator' --principalId 7a2ca997-9461-402e-9882-58088a370889 --scope tenant
Assign a role specified by id to a user specified by UPN and scope the assignment to a service principal specified by id
Assign a role specified by name to a user specified by id and scope the assignment to an administrative unit specified by name
Assign a role specified by name to a user specified by id and scope the assignment to an application specified by id
m365 entra roleassignment add --roleDefinitionName 'Application Administrator' --principalId 7a2ca997-9461-402e-9882-58088a370889 --scope application --applicationId 47539fd8-fc0f-4646-87fb-a4738d5c651b
Default properties
No response
Additional Info
https://learn.microsoft.com/en-us/graph/api/rbacapplication-post-roleassignments?view=graph-rest-1.0&tabs=http
All roles support the tenant wide scope, but some roles can have assignment scoped to the administrative unit, application or service principal.
I will work on it
The text was updated successfully, but these errors were encountered: