Skip to content

New command: app permission add #2813

@waldekmastykarz

Description

@waldekmastykarz

Usage

m365 app permission add [options]

Description

Adds the specified application and/or delegated permissions to the current AAD app API permissions

Options

Option Description
--appId [appId] Client ID of the Azure AD app registered in the .m365rc.json file to retrieve API permissions for
--applicationPermission [applicationPermission] Space-separated list of application permissions to add
--delegatedPermission [delegatedPermission] Space-separated list of delegated permissions to add

Additional Info

Example:

Grant multiple API permissions to the current AAD app

m365 app permission add --delegatedPermission 'https://management.azure.com/user_impersonation https://service.flow.microsoft.com/Flows.Read.All https://graph.microsoft.com/Agreement.Read.All'

Scopes/Roles to grant must be fully-qualified so that we can disambiguate them between the different resources.


Original spec for reference:

Usage

m365 app permission add [options]

Description

Adds permissions to the Azure AD app in the current project

Options

Option Description
-s, --scope <scope> Permission scopes to add
-r, --resource <resource> Service principal name, appId or objectId that has the scopes eg. SharePoint.
--appOnly Set to indicate that the scopes are app-only. If not set, the command will assume that you want to set delegated scopes

Additional Info

You can specify multiple scopes, using a comma-separated string.

The command takes the ID of the Azure AD app registration to add the scopes to from the .m365rc.json file in the working directory. The .m365rc.json file has the following structure:

{
  "appId": "GUID"
}

If the .m365rc.json file is not found, the command returns an error: "Microsoft 365 app configuration file not found". To centralize loading config from the .m365rc.json file, let's introduce a new base class for app commands.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions