Skip to main content

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, manage or fullcontrol)

-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 is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs 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.

Example​

Grants the specified app the read permission to site https://contoso.sharepoint.com/sites/project-x

m365 spo site apppermission add --siteUrl https://contoso.sharepoint.com/sites/project-x --permission read --appDisplayName Foo

Response​

{
"id": "aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0",
"roles": [
"read"
],
"grantedToIdentitiesV2": [
{
"application": {
"displayName": "Foo",
"id": "5c89fbbf-670e-48e7-a0bc-fa8942c895a2"
}
}
],
"grantedToIdentities": [
{
"application": {
"displayName": "Foo",
"id": "5c89fbbf-670e-48e7-a0bc-fa8942c895a2"
}
}
]
}