Skip to content

Commit

Permalink
deploy token-mgmt-role to subscription
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Oberlechner <[email protected]>
  • Loading branch information
geoberle committed Nov 29, 2024
1 parent 34b95c6 commit 927c884
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
25 changes: 3 additions & 22 deletions dev-infrastructure/modules/acr/acr.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,7 @@ resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
}
}

resource tokenManagementRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' = {
name: guid(resourceGroup().id, 'token-creation-role')
properties: {
roleName: 'ACR Manage Tokens'
type: 'customRole'
assignableScopes: [
subscription().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'
'Microsoft.ContainerRegistry/registries/scopeMaps/read'
]
}
]
}
module tokenMgmtRole 'token-mgmt-role.bicep' = {
name: 'acr-token-mgmt-role'
scope: subscription()
}
25 changes: 25 additions & 0 deletions dev-infrastructure/modules/acr/token-mgmt-role.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
targetScope = 'subscription'

resource tokenManagementRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' = {
name: guid('token-mgmt-role')
properties: {
roleName: 'ACR Manage Tokens'
type: 'customRole'
assignableScopes: [
subscription().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'
'Microsoft.ContainerRegistry/registries/scopeMaps/read'
]
}
]
}
}

0 comments on commit 927c884

Please sign in to comment.