param principalId string

module acrPull '../roles/acr-pull.bicep' = {
  name: 'acrPull'
}

resource registry 'Microsoft.ContainerRegistry/registries@2023-07-01' existing = {
  name: 'acrscandicfrontend'
}

resource rbac 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(registry.name, 'ServicePrincipal', principalId, acrPull.name)
  scope: registry
  properties: {
    principalType: 'ServicePrincipal'
    principalId: principalId
    roleDefinitionId: acrPull.outputs.id
  }
}
