Open julioct opened 1 month ago
Update: the --user-assigned
parameter is also needed for this to work properly.
Here's the command I ended up using via the Azure CLI task:
- task: AzureCLI@2
displayName: 'Deploy to ACA'
inputs:
azureSubscription: 'Azure Sponsorship'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
'az containerapp create `
-n catalog-service `
-g $(resourceGroup) `
-i $(acrName).azurecr.io/catalog-service:$(Build.BuildNumber) `
--environment $(containerAppEnv) `
--ingress internal `
--target-port 8080 `
--registry-server $(acrName).azurecr.io `
--registry-identity $(registryIdentity) `
--user-assigned $(registryIdentity)'
When creating a container app, you can use the
--registry-identity
parameter to avoid using username/password combination when ACA needs to authenticate with ACR to pull the image to deploy.As a side benefit, this also sets the User-assigned managed identity that the container app will use, which is key to let the container app access several other Azure resources without the need for connection strings or any sort of API keys.
However, I can't find a way to specify the
--registry-identity
parameter with theAzureContainerAppsRC
task.As a workaround, I tried injecting the missing parameter into the ingress parameter, which is very hacky:
But this only works during initial app creation, not for subsequent updates, where the task fails due to it trying to update the ingress.
The command executed by the task:
Can we either add support for the
--registry-identity
argument or just add anextraArguments
argument where I can add any other desired arguments?Also, notice that when specifying
--registry-identity
you also need to specify--registry-server
, or it won't work.