Usage
m365 spo web roleassignment add [options]
Description
adds a role assignment to web permissions
Options
| Option |
Description |
-u, --webUrl <webUrl> |
URL of the site |
--principalId [principalId] |
SharePoint ID of principal it may be either user id or group id we want to add permissions to. Specify principalId only when upn or groupName are not used. |
--upn [upn] |
upn/email of user to assign role to. Specify either upn or princpialId |
--groupName [groupName] |
enter group name of Azure AD or SharePoint group.. Specify either groupName or princpialId |
--roleDefinitionId [roleDefinitionId] |
ID of role definition. Specify either roleDefinitionId or roleDefinitionName but not both |
--roleDefinitionName [roleDefinitionName] |
enter the name of a role definition, like 'Contribute', 'Read', etc. Specify either roleDefinitionId or roleDefinitionName but not both |
Examples
add roleassignment to web based on group name
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --groupName "saleGroup"
add roleassignment based on principal Id
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --principalId 2
Additional Info
For this we may use this POST endpoint
/_api/web/roleassignments/addroleassignment(principalid='{SomeGroupOrUserIDHere}',roledefid='{SomeRoleIdHere}')
Usage
m365 spo web roleassignment add [options]
Description
adds a role assignment to web permissions
Options
-u, --webUrl <webUrl>--principalId [principalId]--upn [upn]--groupName [groupName]--roleDefinitionId [roleDefinitionId]--roleDefinitionName [roleDefinitionName]Examples
add roleassignment to web based on group name
add roleassignment based on principal Id
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --principalId 2Additional Info
For this we may use this POST endpoint
/_api/web/roleassignments/addroleassignment(principalid='{SomeGroupOrUserIDHere}',roledefid='{SomeRoleIdHere}')