Azure Container Instance - Environment Variables from Azure Key Vault

bogdanr 1 Reputation point
2022-08-31T11:39:54.743+00:00

Hello,

Is there a way to specify Environment Variables values from Azure Key Vault when deploying an Azure Container Instance ?
or some integration of Azure Key Vault with Azure Container Instance

Something like this for .yaml file deployment:

containers:

  • name: test-aci-1
    properties:
    environmentVariables:
  • name: KEYSTORE_PASSWORD
    valuefromAzureKeyVault
Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,448 questions
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Abdul Sajid Mohammed 470 Reputation points Microsoft Employee
    2023-01-20T17:58:55.3433333+00:00

    Hello Bogdanr,

    Assuming you are using Azure DevOps for your Pipelines, Azure Container Instance Deployment.

    One of the ways to integrate and set container instance environment variables and secrets with ADO pipeline from AKV, is to define it in your ADO Variables group library and use that as Environment variable is your Yml file.

    ADO Pipelines-> Library -> Add Variable group -> check the Link secrets from Azure key vaults as variables>Specify your Azure Subscription>Key vaults name and authorize.

    User's image

    After the authorization succeeds, you have referenced your variable to be used in your deployment Yaml pipeline file. After the Azure Cli Service connection task

    2 CLI Examples below:

    In your variables area you can add your created variable group

    variables:

    -group: yourvariablegroup

    During your az container create using Azure CLI command you can pass your variables group values.

    — environment-variables \

    — secure-environment-variables \

    Hope this helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.