Skip to main content

entra roledefinition add

Creates a custom Microsoft Entra ID role definition

Usage

m365 entra roledefinition add [options]

Options

-n, --displayName <displayName>

The display name for the role definition.

-a, --allowedResourceActions <allowedResourceActions>

Comma-separated list of resource actions allowed for the role.

-d, --description [description]

The description for the role definition.

-e, --enabled [enabled]

Indicates if the role is enabled for the assignment. If not specified, the role is enabled by default.

-v, --version [version]

The version of the role definition.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, 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.

Examples

Create a custom Microsoft Entra ID role

m365 entra roledefinition add --displayName 'Application Remover' --description 'Allows to remove any Entra ID application' --allowedResourceActions 'microsoft.directory/applications/delete'

Create a custom Microsoft Entra ID role, but disable it for the assignment

m365 entra roledefinition add --displayName 'Application Remover' --version '1.0' --enabled false --allowedResourceActions 'microsoft.directory/applications/delete,microsoft.directory/applications/owners/update'

Response

{
"id": "3844129d-f748-4c03-8165-4412ee9b4ceb",
"description": null,
"displayName": "Custom Role",
"isBuiltIn": false,
"isEnabled": true,
"resourceScopes": [
"/"
],
"templateId": "3844129d-f748-4c03-8165-4412ee9b4ceb",
"version": "1",
"rolePermissions": [
{
"allowedResourceActions": [
"microsoft.directory/groups.unified/create",
"microsoft.directory/groups.unified/delete"
],
"condition": null
}
]
}

More information

CTRL + M