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

# entra approleassignment list

Lists app role assignments for the specified application registration

## Usage

```sh
m365 entra approleassignment list [options]
```

## Options

```md definition-list
`-i, --appId [appId]`
: Application (client) Id of the App Registration for which the configured app roles should be retrieved

`-n, --appDisplayName [appDisplayName]`
: Display name of the application for which the configured app roles should be retrieved

`--appObjectId [appObjectId]`
: ObjectId of the application for which the configured app roles should be retrieved
```

<Global />

## Remarks

Specify either the `appId`, `appObjectId` or `appDisplayName`. If you specify more than one option value, the command will fail with an error.

## Permissions
<Tabs>
  <TabItem value="Delegated">

  | Resource        | Permissions          |
  |-----------------|----------------------|
  | Microsoft Graph | Application.Read.All |

  </TabItem>
  <TabItem value="Application">

  | Resource        | Permissions          |
  |-----------------|----------------------|
  | Microsoft Graph | Application.Read.All |

  </TabItem>
</Tabs>

## Examples

List app roles assigned to service principal with Application (client) ID _b2307a39-e878-458b-bc90-03bc578531d6_.

```sh
m365 entra approleassignment list --appId b2307a39-e878-458b-bc90-03bc578531d6
```

List app roles assigned to service principal with Application display name _MyAppName_.

```sh
m365 entra approleassignment list --appDisplayName 'MyAppName'
```

List app roles assigned to service principal with ObjectId _b2307a39-e878-458b-bc90-03bc578531dd_.

```sh
m365 entra approleassignment list --appObjectId b2307a39-e878-458b-bc90-03bc578531dd
```

## Response

<Tabs>
  <TabItem value="JSON">

  ```json
  [
    {
      "appRoleId": "810c84a8-4a9e-49e6-bf7d-12d183f40d01",
      "resourceDisplayName": "Microsoft Graph",
      "resourceId": "cd143b5c-7693-42ec-89fb-377e8e97a8ff",
      "roleId": "810c84a8-4a9e-49e6-bf7d-12d183f40d01",
      "roleName": "Mail.Read",
      "created": "2023-06-01T19:10:29.7299757Z",
      "deleted": null
    }
  ]
  ```

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

  ```text
  resourceDisplayName           roleName
  ----------------------------  --------------
  Microsoft Graph               Mail.Read
  ```

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

  ```csv
  appRoleId,resourceDisplayName,resourceId,roleId,roleName,created
  810c84a8-4a9e-49e6-bf7d-12d183f40d01,Microsoft Graph,cd143b5c-7693-42ec-89fb-377e8e97a8ff,810c84a8-4a9e-49e6-bf7d-12d183f40d01,Mail.Read,2023-06-01T19:10:29.7299757Z
  ```

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

  ```md
  # entra approleassignment list --appId "e89804ac-a571-48cf-b2ba-fd57b5d49993"

  Date: 2023-06-01

  Property | Value
  ---------|-------
  appRoleId | 810c84a8-4a9e-49e6-bf7d-12d183f40d01
  resourceDisplayName | Microsoft Graph
  resourceId | cd143b5c-7693-42ec-89fb-377e8e97a8ff
  roleId | 810c84a8-4a9e-49e6-bf7d-12d183f40d01
  roleName | Mail.Read
  created | 2023-06-01T19:10:29.7299757Z
  ```

  </TabItem>
</Tabs>

## More information

- Application and service principal objects in Microsoft Entra ID: [https://learn.microsoft.com/azure/active-directory/develop/active-directory-application-objects](https://learn.microsoft.com/azure/active-directory/develop/active-directory-application-objects)
