@François Baronnet , thank you for your question.
Currently you can define environment variables for your Azure Container Apps using Azure CLI or ARM template.
Azure CLI:
az containerapp create --help
Command
az containerapp create : Create a Containerapp.
...
Container Arguments
...
--environment-variables -v : A list of environment variable(s) for the containerapp. Comma-
separated values in 'key=value' format. If there are multiple
containers, please use --yaml instead.
...
Examples
...
Create a Containerapp with secrets and environment variables
az containerapp create -n MyContainerapp -g MyResourceGroup \
--image MyContainerImage -e MyContainerappEnv \
--secrets mysecret=escapefromtarkov,anothersecret=isadifficultgame
--environment-variables myenvvar=foo,anotherenvvar=bar
Please check here for more information on setting up Azure CLI for Container Apps.
ARM API Specification:
The following is an example ARM template used to deploy a container app.
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"containerappName": {
"defaultValue": "mycontainerapp",
"type": "String"
},
"location": {
"defaultValue": "canadacentral",
"type": "String"
},
"environment_name": {
"defaultValue": "myenvironment",
"type": "String"
}
},
"variables": {},
"resources": [
{
"apiVersion": "2021-03-01",
"type": "Microsoft.Web/containerApps",
"name": "[parameters('containerappName')]",
"location": "[parameters('location')]",
"properties": {
"kubeEnvironmentId": "[resourceId('Microsoft.Web/kubeEnvironments', parameters('environment_name'))]",
"configuration": {
"secrets": [
{
"name": "mysecret",
"value": "thisismysecret"
}
],
"ingress": {
"external": true,
"targetPort": 80,
"allowInsecure": false,
"traffic": [
{
"latestRevision": true,
"weight": 100
}
]
}
},
"template": {
"revisionSuffix": "myrevision",
"containers": [
{
"name": "nginx",
"image": "nginx",
"env": [
{
"name": "HTTP_PORT",
"value": "80"
},
{
"name": "SECRET_VAL",
"secretRef": "mysecret"
}
],
"resources": {
"cpu": 0.5,
"memory": "1Gi"
}
}
],
"scale": {
"minReplicas": 1,
"maxReplicas": 3
}
}
}
}
]
}
For more information please check here.
----
Hope this helps.
Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.