Last active
June 8, 2021 06:43
-
-
Save azMantas/7a1c519ce9c846d59ae756eb448593a3 to your computer and use it in GitHub Desktop.
assign RBAC role for multiple principals in bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
targetScope = 'managementGroup' | |
param roleDefinitionId string = 'b60367af-1334-4454-b71e-769d9a4f83d9' | |
param assignmentScope string = 'BicepRules' | |
param principalIds array = [ | |
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', | |
'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy' | |
] | |
resource rbac 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = [for principal in principalIds: { | |
name: guid(roleDefinitionId, assignmentScope, principal) | |
properties: { | |
principalId: principal | |
roleDefinitionId: '/providers/Microsoft.Authorization/roleDefinitions/${roleDefinitionId}' | |
} | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment