Skip to content

Commit

Permalink
move tole to acr module
Browse files Browse the repository at this point in the history
  • Loading branch information
janboll committed Nov 13, 2024
1 parent bcba7ed commit 2dba4a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
23 changes: 2 additions & 21 deletions dev-infrastructure/modules/acr-permissions.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,8 @@ resource acrDeleteRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = if
}
}

resource tokenManagementRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' = if (grantManageTokenAccess) {
name: guid(acrResourceGroupid, principalId, 'token-creation-role')
properties: {
assignableScopes: [
subscription().id
acrResourceGroupid
]
description: 'This role allows the management of tokens in the ACR'
permissions: [
{
actions: [
'Microsoft.ContainerRegistry/registries/tokens/read'
'Microsoft.ContainerRegistry/registries/tokens/write'
'Microsoft.ContainerRegistry/registries/tokens/delete'
'Microsoft.ContainerRegistry/registries/generateCredentials/action'
'Microsoft.ContainerRegistry/registries/tokens/operationStatuses/read'
]
}
]
roleName: 'ACR Manage Tokens'
}
resource tokenManagementRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = if (grantManageTokenAccess) {
name: guid(acrResourceGroupid, 'token-creation-role')
}

resource acrContributorRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (grantManageTokenAccess) {
Expand Down
23 changes: 23 additions & 0 deletions dev-infrastructure/modules/acr/acr.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,26 @@ resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', acrPullRoleId)
}
}

resource tokenManagementRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' = {
name: guid(resourceGroup().id, 'token-creation-role')
properties: {
assignableScopes: [
subscription().id
resourceGroup().id
]
description: 'This role allows the management of tokens in the ACR'
permissions: [
{
actions: [
'Microsoft.ContainerRegistry/registries/tokens/read'
'Microsoft.ContainerRegistry/registries/tokens/write'
'Microsoft.ContainerRegistry/registries/tokens/delete'
'Microsoft.ContainerRegistry/registries/generateCredentials/action'
'Microsoft.ContainerRegistry/registries/tokens/operationStatuses/read'
]
}
]
roleName: 'ACR Manage Tokens'
}
}

0 comments on commit 2dba4a7

Please sign in to comment.