Referencing Key Vault secrets in a new Container App #12056
Closed
AndersSahlin
started this conversation in
Authoring Help
Replies: 2 comments 2 replies
-
Can you use a user-assigned managed identity instead of a system assigned one? You can create a user-assigned managed identity before creating either the Key Vault or the container app, which should take care of the chicken-and-egg situation you're facing now: resource managedId 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'containerAppManagedId'
location: resourceGroup().location
}
// ...
resource containerAppApi 'Microsoft.App/containerApps@2023-05-02-preview' = {
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${managedId.id}': {}
}
}
// ...
}
// ...
resource keyVaultSecretUserRoleAssignment_ContainerAppApi 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
scope: keyVault
name: guid(resourceGroup().id, managedId.id, keyVaultSecretUserRoleRoleDefinition.id)
properties: {
roleDefinitionId: keyVaultSecretUserRoleRoleDefinition.id
principalId: managedId.properties.principalId
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
Would be great if there was a way to actually solve the issue with this feature, rather than the solution being "just don't" |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am creating a new Container App and Key Vault using a Bicep template. I want the Container App to contain a secret that is referencing a Key Vault secret (password to Container registry). I want the Container App to authenticate to the Key Vault using its System assigned identity.
It seems like I cannot accomplish this, since the key vault role assignment needs the Container app to be created first, and the Container app deployment times out since it cannot resolve the secret from the key vault reference.
Does anyone have a suggestion on how to approach this issue? Can I insert the secrets in a secondary Bicep block like you can with Key Vault secrets or Web App appsettings?
Minimal example:
Beta Was this translation helpful? Give feedback.
All reactions