0

I am using the Azure CLI 2.0 and don't see any documentation on adding a custom role via a json document. Can someone help?

I assume it starts out like this: $ az role create .. but that doesn't exist, apparently.

juvchan
  • 6,113
  • 2
  • 22
  • 35

2 Answers2

2

For Azure CLI 2.0, you can create a new custom role via JSON file containing the role definition using the Azure CLI command as below.

az role definition create --role-definition @ad-role.json

where ad-role.json is the JSON file which has the valid role definition residing in the same directory from where you run the command above.

You can refer to this Microsoft documentation for examples on how to use the latest Azure CLI to create the custom role.

Hope this helps.

juvchan
  • 6,113
  • 2
  • 22
  • 35
0

Create a custom role in Azure Role-Based Access Control (RBAC) if none of the built-in roles meet your specific access needs. Custom roles can be created using Azure PowerShell, Azure Command-Line Interface (CLI), and the REST API.

To create a custom role using JSON, use the following cmdlet:

azure role create --inputfile

For more details, refer "Create a custom role"

Manage user roles for access control with Azure Active Directory and service principals, refer "az role".

CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42