When making the assignment to the group via Bicep, ensure that you are using the ObjectId of the Group.
var roleDefinitionContributor = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', permissionContributorId)
resource roleass 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
name: guid(resourceGroup().id, adGroupObjectId, roleDefinitionContributor)
properties: {
principalId: adGroupObjectId
roleDefinitionId: roleDefinitionContributor
}
}
You may have to wait a couple of minutes after adding yourself to the group to allow for propagation.
To answer your other question about making multiple assignments, you should use loops in bicep.
Something like this;
param groupIds array = ['123', '456']
var AcrPullRole = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d')
resource aks_acr_pull 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for groupId in groupIds: {
name: guid('resourceId', groupId, AcrPullRole)
properties: {
roleDefinitionId: AcrPullRole
principalId: groupId
}
}]