Skip to content

Commit 7c461ed

Browse files
fix: Added Role assignment for managed identity to pull the image from Container
1 parent 452f001 commit 7c461ed

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

infra/main.bicep

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,13 @@ module avmContainerRegistry 'modules/container-registry.bicep' = {
467467
acrSku: 'Standard'
468468
publicNetworkAccess: 'Enabled'
469469
zoneRedundancy: 'Disabled'
470+
roleAssignments: [
471+
{
472+
principalId: avmContainerRegistryReader.outputs.principalId
473+
roleDefinitionIdOrName: 'AcrPull'
474+
principalType: 'ServicePrincipal'
475+
}
476+
]
470477
tags: tags
471478
}
472479
}

infra/modules/container-registry.bicep

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ param publicNetworkAccess string = 'Enabled'
1616
@description('Zone redundancy setting for the Azure Container Registry')
1717
param zoneRedundancy string = 'Disabled'
1818

19+
import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
20+
@description('Optional. Array of role assignments to create.')
21+
param roleAssignments roleAssignmentType[]?
22+
1923
@description('Tags to be applied to the Container Registry')
2024
param tags object = {}
2125

@@ -27,6 +31,7 @@ module avmContainerRegistry 'br/public:avm/res/container-registry/registry:0.9.1
2731
acrSku: acrSku
2832
publicNetworkAccess: publicNetworkAccess
2933
zoneRedundancy: zoneRedundancy
34+
roleAssignments: roleAssignments
3035
tags: tags
3136
}
3237
}

0 commit comments

Comments
 (0)