spo web roleassignment add
Adds a role assignment to web permissions.
Usage
m365 spo web roleassignment add [options]
Options
-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 either
principalId,upn, orgroupNamebut not multiple.--upn [upn]upn/email of user to assign role to. Specify either
principalId,upn, orgroupNamebut not multiple.--groupName [groupName]enter group name of Azure AD or SharePoint group. Specify either
principalId,upn, orgroupNamebut not multiple.--roleDefinitionId [roleDefinitionId]ID of role definition. Specify either
roleDefinitionIdorroleDefinitionNamebut not both.--roleDefinitionName [roleDefinitionName]enter the name of a role definition, like 'Contribute', 'Read', etc. Specify either
roleDefinitionIdorroleDefinitionNamebut not both.
-h, --help [help]Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options,examples,remarks,response,full. Default isfull.--query [query]JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]Output type.
json,text,csv,md. Defaultjson.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Examples
add role assignment to a site principal id 11 and role definition id 1073741829
m365 spo web roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --principalId 11 --roleDefinitionId 1073741829
add role assignment to a site for a upn and role definition id 1073741829
m365 spo web roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --upn "someaccount@tenant.onmicrosoft.com" --roleDefinitionId 1073741829
add role assignment to a site for group someGroup and role definition id 1073741829
m365 spo web roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --groupName "someGroup" --roleDefinitionId 1073741829
add role assignment to a site for principal id 11 and role definition name Full Control
m365 spo web roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --principalId 11 --roleDefinitionName "Full Control"
Response
The command won't return a response on success.