import Global from '../../_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# spo site apppermission set

Updates a specific application permission for a site

## Usage

```sh
m365 spo site apppermission set [options]
```

## Options

```md definition-list
`-u, --siteUrl <siteUrl>`
: URL of the site collection where the permission to retrieve is located

`-i, --id [id]`
: ID of the permission to update. Specify `id`, `appId` or `appDisplayName`

`--appId [appId]`
: Client ID of the Microsoft Entra app for which to update permissions. Specify `id`, `appId` or `appDisplayName`

`-n, --appDisplayName [appDisplayName]`
: Display name of the Microsoft Entra app for which to update permissions. Specify `id`, `appId` or `appDisplayName`

`-p, --permission <permission>`
: Permission to site (`read`, `write`, `manage` or `fullcontrol`)
```

<Global />

## Examples

Updates a specific application permission to _read_ for the _https://contoso.sharepoint.com/sites/project-x_ site collection with permission id _aTowaS50fG1zLnNwLmV4dHw4OWVhNWM5NC03NzM2LTRlMjUtOTVhZC0zZmE5NWY2MmI2NmVAZGUzNDhiYzctMWFlYi00NDA2LThjYjMtOTdkYjAyMWNhZGI0_

```sh
m365 spo site apppermission set --siteUrl https://contoso.sharepoint.com/sites/project-x --id aTowaS50fG1zLnNwLmV4dHw4OWVhNWM5NC03NzM2LTRlMjUtOTVhZC0zZmE5NWY2MmI2NmVAZGUzNDhiYzctMWFlYi00NDA2LThjYjMtOTdkYjAyMWNhZGI0 --permission read
```

Updates a specific application permission to _read_ for the _https://contoso.sharepoint.com/sites/project-x_ site collection with an application called _Foo_

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

Updates a specific application permission to _read_ for the _https://contoso.sharepoint.com/sites/project-x_ site collection with an application id _89ea5c94-7736-4e25-95ad-3fa95f62b66e_

```sh
m365 spo site apppermission set --siteUrl https://contoso.sharepoint.com/sites/project-x --appId 89ea5c94-7736-4e25-95ad-3fa95f62b66e --permission read
```

## Response

<Tabs>
  <TabItem value="JSON">

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

  </TabItem>
  <TabItem value="Text">

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

  </TabItem>
  <TabItem value="CSV">

  ```csv
  id
  aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0
  ```

  </TabItem>
  <TabItem value="Markdown">

  ```md
  # spo site apppermission set --siteUrl "https://contoso.sharepoint.com/sites/marketing" --appDisplayName "Foo" --permission "read"

  Date: 2023-06-21

  ## aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0

  Property | Value
  ---------|-------
  id | aTowaS50fG1zLnNwLmV4dHw1Yzg5ZmJiZi02NzBlLTQ4ZTctYTBiYy1mYTg5NDJjODk1YTJAMWU4NTJiNDktYmY0Yi00YmE1LWJjZDQtYThjNDcwNmM4ZWQ0
  ```

  </TabItem>
</Tabs>
