Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: support for the friendly names of the builtin roles #3642

Open
t3mi opened this issue Dec 12, 2023 · 3 comments
Open

Improvement: support for the friendly names of the builtin roles #3642

t3mi opened this issue Dec 12, 2023 · 3 comments
Assignees

Comments

@t3mi
Copy link
Contributor

t3mi commented Dec 12, 2023

Describe the current behavior
Currently, RoleAssignment resource requires full armId value for the role which is big and unfriendly and requires subscriptionId to be present.

Describe the improvement
Please add in addition support for a friendly name of the builtin role so that instead of this

apiVersion: authorization.azure.com/v1api20200801preview
kind: RoleAssignment
metadata:
  name: aso-sample-contributor
  namespace: default
spec:
  ...
  roleDefinitionReference:
    # This ARM ID represents "Contributor" - you can read about other built in roles here: https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles
    armId: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c

user could use name of the role like this

apiVersion: authorization.azure.com/v1api20200801preview
kind: RoleAssignment
metadata:
  name: aso-sample-contributor
  namespace: default
spec:
  ...
  roleDefinitionReference:
    armName: Contributor
@theunrepentantgeek
Copy link
Member

Good suggestion.

(Leaving needs-triage so that we discuss this when we resume our weekly sync in the new year.)

@matthchr matthchr added this to the v2.7.0 milestone Jan 8, 2024
@matthchr matthchr removed this from the v2.7.0 milestone Feb 22, 2024
@matthchr
Copy link
Member

matthchr commented Jul 29, 2024

We're still interested in doing this. We would be open to contributions. I would be curious how BICEP/ARM templates or something like the CLI does this.

Is it just a magical list of well-known names hardcoded, or is there some API to call?

@theunrepentantgeek
Copy link
Member

There's a REST API to call - https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01, which returns a list of roles like this:

    {
      "id": "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c",
      "name": "b24988ac-6180-42a0-ab88-20f7382dd24c",
      "properties": {
        "assignableScopes": [
          "/"
        ],
        "createdBy": null,
        "createdOn": "2015-02-02T21:55:09.8806423Z",
        "description": "Grants full access to manage all resources, but does not allow you to assign roles in Azure RBAC, manage assignments in Azure Blueprints, or share image galleries.",
        "permissions": [
          {
            "actions": [
              "*"
            ],
            "dataActions": [],
            "notActions": [
              "Microsoft.Authorization/*/Delete",
              "Microsoft.Authorization/*/Write",
              "Microsoft.Authorization/elevateAccess/Action",
              "Microsoft.Blueprint/blueprintAssignments/write",
              "Microsoft.Blueprint/blueprintAssignments/delete",
              "Microsoft.Compute/galleries/share/action",
              "Microsoft.Purview/consents/write",
              "Microsoft.Purview/consents/delete",
              "Microsoft.Resources/deploymentStacks/manageDenySetting/action"
            ],
            "notDataActions": []
          }
        ],
        "roleName": "Contributor",
        "type": "BuiltInRole",
        "updatedBy": null,
        "updatedOn": "2024-05-15T21:41:09.7999413Z"
      },
      "type": "Microsoft.Authorization/roleDefinitions"
    },

Note how it's flagged as BuiltInRole. There are 703 built in roles 😮

I'm wondering if we could use the new operatorSpec support to enable lookup of these "on the fly", giving a result like this:

apiVersion: authorization.azure.com/v1api20200801preview
kind: RoleAssignment
metadata:
  name: aso-sample-contributor
  namespace: default
spec:
  ...
  operatorSpec:
    builtInRole: Contributor

@matthchr matthchr added this to the v2.11.0 milestone Sep 16, 2024
@theunrepentantgeek theunrepentantgeek modified the milestones: v2.11.0, v2.12.0 Nov 18, 2024
@theunrepentantgeek theunrepentantgeek moved this from Backlog to Up Next in Azure Service Operator Roadmap Feb 10, 2025
@theunrepentantgeek theunrepentantgeek modified the milestones: v2.12.0, v2.13.0 Feb 11, 2025
@theunrepentantgeek theunrepentantgeek removed this from the v2.13.0 milestone Feb 24, 2025
@theunrepentantgeek theunrepentantgeek self-assigned this Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants