spe container permission add
Adds permission to SharePoint Embedded container for a specified user
Usage
m365 spe container permission add [options]
Options
-i, --containerId [containerId]ID of a SharePoint Embedded container. Specify either
containerIdorcontainerNamebut not both.-n, --containerName [containerName]Display name of the Container. Specify either
containerIdorcontainerNamebut not both.--containerTypeId [containerTypeId]The ID of the container type. Specify either
containerTypeIdorcontainerTypeNamewhen usingcontainerNamebut not both.--containerTypeName [containerTypeName]The name of the container type. Specify either
containerTypeIdorcontainerTypeNamewhen usingcontainerNamebut not both.-r, --roles <roles>Comma-separated list of roles. Possible values are
reader,writer,manager,owner.--userId [userId]The ID of the user to assign the role to. Use either
userIdoruserNamebut not both.--userName [userName]The UPN of user to assign the role to. Use either
userIdoruserNamebut 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,permissions,response,full. Default isoptions.--query [query]JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]Output type.
json,text,csv,md,none. Defaultjson.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Permissions
- Delegated
- Application
| Resource | Permissions |
|---|---|
| Microsoft Graph | FileStorageContainer.Selected |
| Resource | Permissions |
|---|---|
| Microsoft Graph | FileStorageContainer.Selected |
When using --userId, Microsoft Graph also requires User.ReadBasic.All for delegated authentication or User.Read.All for application authentication to resolve the user's principal name.
When using --containerTypeName, resolving the container type requires delegated authentication, the FileStorageContainerType.Manage.All permission, and the SharePoint Administrator or Global Administrator role. For application authentication, use --containerId, or --containerName with --containerTypeId, instead.
Examples
Adds a reader role for the specified user to the container
m365 spe container permission add --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" --roles "reader" --userName "jacob@fabrikam.com"
Adds multiple roles for the specified user to the container
m365 spe container permission add --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" --roles "reader,writer" --userName "jacob@fabrikam.com"
Response
- JSON
- Text
- CSV
- Markdown
{
"id": "cJpbmNpcGFsT3duZAJfaLowIy5mfG1lbWJliZXJzaGlwfHJvcnlicjExMUBvdXRsb29rLmNvbQ",
"roles": ["reader"],
"grantedToV2": {
"user": {
"id": "89ea5c94-7736-4e25-95ad-3fa95f62b66e",
"userPrincipalName": "john.doe@contoso.com",
"displayName": "John Doe",
"email": "john.doe@contoso.com"
}
}
}
grantedToV2: {"user":{"id":"89ea5c94-7736-4e25-95ad-3fa95f62b66e","userPrincipalName":"john.doe@contoso.com","displayName":"John Doe","email":"john.doe@contoso.com"}}
id : cJpbmNpcGFsT3duZAJfaLowIy5mfG1lbWJliZXJzaGlwfHJvcnlicjExMUBvdXRsb29rLmNvbQ
roles : ["reader"]
id
cJpbmNpcGFsT3duZAJfaLowIy5mfG1lbWJliZXJzaGlwfHJvcnlicjExMUBvdXRsb29rLmNvbQ
# spe container permission add --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" --userId "89ea5c94-7736-4e25-95ad-3fa95f62b66e" --roles "reader"
Date: 8/5/2025
## cJpbmNpcGFsT3duZAJfaLowIy5mfG1lbWJliZXJzaGlwfHJvcnlicjExMUBvdXRsb29rLmNvbQ
Property | Value
---------|-------
id | cJpbmNpcGFsT3duZAJfaLowIy5mfG1lbWJliZXJzaGlwfHJvcnlicjExMUBvdXRsb29rLmNvbQ