From 8ab49a8edc170cc242e79c9652b766252bb94103 Mon Sep 17 00:00:00 2001 From: sinedied Date: Thu, 21 Mar 2024 21:38:44 +0100 Subject: [PATCH] fix: missing client id for user assigned identity --- infra/core/security/managed-identity.bicep | 4 ++++ infra/main.bicep | 22 ++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/infra/core/security/managed-identity.bicep b/infra/core/security/managed-identity.bicep index 50cb4682..f46c1d96 100644 --- a/infra/core/security/managed-identity.bicep +++ b/infra/core/security/managed-identity.bicep @@ -5,3 +5,7 @@ resource apiIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-3 name: name location: location } + +output tenantId string = apiIdentity.properties.tenantId +output principalId string = apiIdentity.properties.principalId +output clientId string = apiIdentity.properties.clientId diff --git a/infra/main.bicep b/infra/main.bicep index f3da6ff3..0eb101f3 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -213,16 +213,17 @@ module searchApi './core/host/container-app.bicep' = { value: storageContainerName } { - name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' - secretRef: 'appinsights-cs' + name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' + secretRef: 'appinsights-cs' + } + { + name: 'AZURE_CLIENT_ID' + value: searchApiIdentity.outputs.clientId } ] imageName: !empty(searchApiImageName) ? searchApiImageName : 'nginx:latest' targetPort: 3000 } - dependsOn: [ - searchApiIdentity - ] } // Indexer API identity @@ -292,16 +293,17 @@ module indexerApi './core/host/container-app.bicep' = { value: storageContainerName } { - name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' - secretRef: 'appinsights-cs' + name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' + secretRef: 'appinsights-cs' + } + { + name: 'AZURE_CLIENT_ID' + value: indexerApiIdentity.outputs.clientId } ] imageName: !empty(indexerApiImageName) ? indexerApiImageName : 'nginx:latest' targetPort: 3001 } - dependsOn: [ - indexerApiIdentity - ] } module openAi 'core/ai/cognitiveservices.bicep' = {