GitHub Actions: Update Azure Container Apps Environment Variables

Kontext Kontext 0 705 0.90 index 5/10/2023

Code description

GitHub Actions provides action azure/container-apps-deploy-action to deploy built container into Azure Container Apps. This action's attribute environmentVariables can be used to replace the existing variables. If you only want to update some variables, we can use Azure CLI commands.

References

https://github.com/Azure/container-apps-deploy-action

Code snippet

    jobs:
      update-container-app:
        runs-on: ubuntu-latest
        permissions:
          contents: read
          id-token: write
        steps:
          - uses: azure/login@v1
            with:
              client-id: ${{ secrets.AZURE_CLIENT_ID }}
              tenant-id: ${{ secrets.AZURE_TENANT_ID }}
              subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
    
          # Update environment variable
          - name: Update container app environment variables
            uses: azure/CLI@v1
            with:
              inlineScript: |
                az config set extension.use_dynamic_install=yes_without_prompt
                az containerapp update -n MyApp -g MyResourceGroup --set-env-vars "VAR1=Value1"
    
azure devops docker yaml

Join the Discussion

View or add your thoughts below

Comments