spo site apppermission add
Adds a specific application permissions to the site
Usage
m365 spo site apppermission add [options]
Options
-u, --siteUrl <siteUrl>URL of the site collection to add the permission
-p, --permission <permission>Permission to site (
read,write,manageorfullcontrol)-i, --appId [appId]Client ID of the Microsoft Entra app for which to grant permissions
-n, --appDisplayName [appDisplayName]Display name of the Microsoft Entra app for which to grant permissions
-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.
Remarks
To set permissions, specify at minimum either appId or appDisplayName. For best performance specify both values to avoid extra lookup.
Permissions
- Delegated
- Application
| Resource | Permissions |
|---|---|
| Microsoft Graph | Sites.FullControl.All, Application.Read.All |
| Resource | Permissions |
|---|---|
| Microsoft Graph | Sites.FullControl.All, Application.Read.All |
Examples
Grants the app with the specified display name the read permission to a specific site
m365 spo site apppermission add --siteUrl https://contoso.sharepoint.com/sites/project-x --permission read --appDisplayName Foo
Grants the app with the specified ID the write permission to a specific site
m365 spo site apppermission add --siteUrl https://contoso.sharepoint.com/sites/project-x --permission write --appId 5c89fbbf-670e-48e7-a0bc-fa8942c895a2
Grants the app with the specified ID and display name the manage permission to a specific site
m365 spo site apppermission add --siteUrl https://contoso.sharepoint.com/sites/project-x --permission manage --appId 5c89fbbf-670e-48e7-a0bc-fa8942c895a2 --appDisplayName Foo
Response
- JSON
- Text
- CSV
- Markdown
{
"id": "aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0",
"roles": [
"read"
],
"grantedToIdentitiesV2": [
{
"application": {
"displayName": "Foo",
"id": "5c89fbbf-670e-48e7-a0bc-fa8942c895a2"
}
}
],
"grantedToIdentities": [
{
"application": {
"displayName": "Foo",
"id": "5c89fbbf-670e-48e7-a0bc-fa8942c895a2"
}
}
]
}
grantedToIdentities : [{"application":{"displayName":"Foo","id":"5c89fbbf-670e-48e7-a0bc-fa8942c895a2"}}]
grantedToIdentitiesV2: [{"application":{"displayName":"Foo","id":"5c89fbbf-670e-48e7-a0bc-fa8942c895a2"}}]
id : aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0
roles : ["read"]
id
aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0
# spo site apppermission add --siteUrl "https://contoso.sharepoint.com/sites/team1" --permission "read" --appDisplayName "Foo"
Date: 2023-06-21
## aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0
Property | Value
---------|-------
id | aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0