Azure / Azure/bicep

Ease of role assignments

Open
#6,531 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

One thing that Azure has started supporting well and pushing hard is RBAC, but unless I'm missing something (please tell me, it would make my life easier!), it's actually kind of hard to discover built in role guids, you have to really dig around for them.

It would be great if bicep could automatically autocomplete built in roles from a special list and replace with the guid when compiling. This would encourage more secure practices; i.e. make it easier to use RBAC instead of shared keys.

Current syntax:
```bicep
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
name: guid(resourceGroup().id, resourceId, roleId)
properties: {
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', roleId)
principalId: principalId
principalType: 'ServicePrincipal'
}
}
```

Suggested (pseudocode) syntax:
```bicep
resource appService 'Microsoft.Web/sites@2021-02-01' = {
name: name
kind: 'app,linux,container'
location: location
identity: {
type: 'SystemAssigned'
}
properties: {
....
}

assignRole myAcrPull = {
principalId: appService.identity.principalId
scope: acr.id
roles: [
'AcrPull'
]
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by comparing the current roleAssignments syntax with the proposed assignRole syntax and determine how built-in role names would map to GUIDs during compilation. Define the supported role list, scope and principal behavior, and acceptance tests for the generated role assignments and compiled role IDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
authorization, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.