Azure-docs: Updating Custom Role Process Is Wrong

Created on 1 Jul 2019  Â·  4Comments  Â·  Source: MicrosoftDocs/azure-docs

When updating a custom role, this page says to use az role definition list to grab the role, then makes changes, then az role definition update to update. The problem is that the list action returns the wrong json schema. For me it returns:

[
  {
    "assignableScopes": [
      "/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXX"
    ],
    "description": "Can create/modify resource groups and assign access.",
    "id": "/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXX/providers/Microsoft.Authorization/roleDefinitions/XXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "name": "XXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "permissions": [
      {
        "actions": [
          "Microsoft.Resources/subscriptions/read",
          "Microsoft.Resources/subscriptions/resourceGroups/read",
          "Microsoft.Resources/subscriptions/resourceGroups/write"
        ],
        "dataActions": [],
        "notActions": [],
        "notDataActions": []
      }
    ],
    "roleName": "Custom Role",
    "roleType": "CustomRole",
    "type": "Microsoft.Authorization/roleDefinitions"
  }
]

When for example, adding a scope here, and then using the update command I get Invalid role definition. A valid dictionary JSON representation is expected. What I am having to do is convert it to the format given on this page:

{
  "Name": "Custom Role",
  "IsCustom": true,
  "Description": "Can create/modify resource groups and assign access.",
  "Actions": [
    "Microsoft.Resources/subscriptions/read",
    "Microsoft.Resources/subscriptions/resourceGroups/read",
    "Microsoft.Resources/subscriptions/resourceGroups/write"
  ],
  "NotActions": [],
  "DataActions": [],
  "NotDataActions": [],
  "AssignableScopes": [
    "/subscriptions/XXXXXXXXXXXXXXXX",
    "/subscriptions/XXXXXXXXXXXXXXXXXXXX"
  ]
}

So I think the output format for list has changed and makes you do a little more work for updating your roles (keeping the role in scm to reference).


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

assigned-to-author doc-enhancement role-based-access-controsvc triaged

Most helpful comment

Hi @snyder-riley-pfg
Thanks for the feedback. You are correct that when you list a custom role, the output format does not exactly match what is required for the input. I will update this article to make this more clear. I think the custom role tutorial does a little better job at communicating this.
https://docs.microsoft.com/en-us/azure/role-based-access-control/tutorial-custom-role-cli

All 4 comments

Thanks for your comment. The feedback has been shared with the content owner for further review. Thanks for your patience.

Hi @snyder-riley-pfg
Thanks for the feedback. You are correct that when you list a custom role, the output format does not exactly match what is required for the input. I will update this article to make this more clear. I think the custom role tutorial does a little better job at communicating this.
https://docs.microsoft.com/en-us/azure/role-based-access-control/tutorial-custom-role-cli

Thanks! I saw that other page and it helped, I just wanted to make sure this documentation was fixed to match up with the new output.

Thanks again @snyder-riley-pfg
We will now close this issue. If there are further questions regarding this matter, please reply and we will gladly continue the discussion.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spottedmahn picture spottedmahn  Â·  3Comments

behnam89 picture behnam89  Â·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments

jebeld17 picture jebeld17  Â·  3Comments

paulmarshall picture paulmarshall  Â·  3Comments