pnp/cli-microsoft365

New command 'entra enterpriseapp permission list' - Get a list of app-only and delegated permissions for an enterprise application

Open

#5,778 opened on Jan 16, 2024

View on GitHub
 (8 comments) (1 reaction) (0 assignees)TypeScript (399 forks)auto 404
good first issuehelp wantedkeep-opennew feature

Repository metrics

Stars
 (1,390 stars)
PR merge metrics
 (PR metrics pending)

Description

Related to entra app permission list, but for enterprise applications / service principals

We currently have the following commands that cover listing permissions from an enterprise application / service principal:

This issue is for adding the same functionality in a more consistent way, that can in some time replace the oauthgrant and approleassignment commands.

We're also implementing a rename of entra serviceprincipal verb, which is why we're adding this in the correct command group right from the start.

Usage

m365 entra enterpriseapp permission list [options]

Description

Lists the application and delegated permissions for a specified Entra enterprise application

Options

Option Description
-i, --appId [appId] Client ID of the Entra enterprise app to retrieve the permissions for. Specify either appId, appName or appObjectId.
--appObjectId [appObjectId] Object ID of the Entra enterprise app to retrieve the permissions for. Specify either appId, appName or appObjectId.
-n, --appName [appName] Display name of the Entra enterprise app to retrieve the API permissions for. Specify either appId, appName or appObjectId.
--type [type] The type of permissions to retrieve. Allowed values: delegated, application, all. Defaults to all

Examples

Retrieves all permissions for an Entra enterprise application

m365 entra enterpriseapp permission list --appId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690'

Retrieves all delegated permissions for an Entra enterprise application

m365 entra enterpriseapp permission list --appId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --type delegated

Response

[
  {
    "resource": "Microsoft Graph",
    "resourceId": "00000003-0000-0000-c000-000000000000",
    "permission": "RecordsManagement.ReadWrite.All",
    "type": "Application"
  },
  {
    "resource": "Microsoft Graph",
    "resourceId": "00000003-0000-0000-c000-000000000000",
    "permission": "Sites.Read.All",
    "type": "Application"
  },
  {
    "resource": "Office 365 SharePoint Online",
    "resourceId": "00000003-0000-0ff1-ce00-000000000000",
    "permission": "AllSites.Read",
    "type": "Delegated"
  },
]

Additional information

If multiple apps with the same name exist, the CLI should show a disambiguation prompt to let the user choose.

Contributor guide