diff --git a/.github/workflows/cms.yaml b/.github/workflows/cms.yaml index b578c82..fb2bfb9 100644 --- a/.github/workflows/cms.yaml +++ b/.github/workflows/cms.yaml @@ -26,7 +26,7 @@ jobs: resourceLocation: ${{ steps.deployinfra.outputs.resourceLocation }} logAnalyticsWorkspaceName: ${{ steps.deployinfra.outputs.logAnalyticsWorkspaceName }} keyVaultName: ${{ steps.deployinfra.outputs.keyVaultName }} - identityResourceId: ${{ steps.deployinfra.outputs.identityResourceId }} + identityName: ${{ steps.deployinfra.outputs.identityName }} steps: - uses: actions/checkout@v4 @@ -105,7 +105,7 @@ jobs: logAnalyticsWorkspaceName=${{ needs.deploy_infra.outputs.logAnalyticsWorkspaceName }} keyVaultName=${{ needs.deploy_infra.outputs.keyVaultName }} registryName=${{ needs.deploy_infra.outputs.containerRegistryName }} - identityResourceId=${{ needs.deploy_infra.outputs.identityResourceId }} + identityName=${{ needs.deploy_infra.outputs.identityName }} cmsImageName=${{ needs.deploy_infra.outputs.containerRegistryLoginServer }}/cms:latest cmsInitImageName=${{ needs.deploy_infra.outputs.containerRegistryLoginServer }}/cms/init:latest region: ${{ vars.AZURE_REGION }} diff --git a/infrastructure/cms/infrastructure.bicep b/infrastructure/cms/infrastructure.bicep index 7a657ac..85fb59d 100644 --- a/infrastructure/cms/infrastructure.bicep +++ b/infrastructure/cms/infrastructure.bicep @@ -43,4 +43,4 @@ output containerRegistryName string = containerRegistry.outputs.registryName output containerRegistryLoginServer string = containerRegistry.outputs.registryLoginServer output logAnalyticsWorkspaceName string = logAnalyticsWorkspace.outputs.resourceName output keyVaultName string = keyVault.outputs.resourceName -output identityResourceId string = cmsIdentity.outputs.resourceId +output identityName string = cmsIdentity.outputs.name diff --git a/infrastructure/cms/main.bicep b/infrastructure/cms/main.bicep index 8d400d5..2f66308 100644 --- a/infrastructure/cms/main.bicep +++ b/infrastructure/cms/main.bicep @@ -4,7 +4,7 @@ param databaseClient string param logAnalyticsWorkspaceName string param keyVaultName string param registryName string -param identityResourceId string +param identityName string param cmsImageName string param cmsInitImageName string = '' @@ -20,6 +20,10 @@ resource registry 'Microsoft.ContainerRegistry/registries@2023-07-01' existing = name: registryName } +resource cmsIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = { + name: identityName +} + module mySql '../modules/sql.bicep' = { name: 'deployMysql' params: { @@ -36,7 +40,7 @@ module cmsContainerApp '../modules/containerApp.bicep' = { initImageName: cmsInitImageName logAnalyicsWorkspaceName: logAnalyticsWorkspaceName targetPort: 1337 - cmsIdentityResourceId: identityResourceId + cmsIdentityResourceId: cmsIdentity.id keyVaultUri: keyVault.properties.vaultUri registryLoginServer: registry.properties.loginServer environmentVariables: [ diff --git a/infrastructure/modules/identity.bicep b/infrastructure/modules/identity.bicep index f421339..89641b2 100644 --- a/infrastructure/modules/identity.bicep +++ b/infrastructure/modules/identity.bicep @@ -7,5 +7,5 @@ resource cmsIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-3 location: resourceGroup().location } -output resourceId string = cmsIdentity.id +output name string = cmsIdentity.name output principalId string = cmsIdentity.properties.principalId