Replies: 2 comments 9 replies
-
Hi @RamType0 When you're running your app locally, you can easily set the environment (like There are multiple ways to do it: 1. Azure Portal (Easy Way)You can set the environment variable directly in the Azure Portal:
Boom! Now Azure knows which environment to run in. 2. Azure CLI (Command Line)If you're more of a command line person or you're automating deployments, you can set the environment variable with Azure CLI. Just run this command: az containerapp update --name <app-name> \
--resource-group <resource-group> \
--set-env-vars "ASPNETCORE_ENVIRONMENT=Production" This tells Azure to run the app in "Production" mode. 3. DockerfileIf you're using Docker to build your app, you can include the environment variable right in your ENV ASPNETCORE_ENVIRONMENT=Production This way, when you build your container and deploy it, Azure will know to run it in 4. Bicep/ARM Templates (For Infra Nerds)If you’re deploying using infrastructure-as-code (like Bicep or ARM templates), you can define the environment variable in the template itself. Here’s a quick example for Bicep: resource containerApp 'Microsoft.Web/containerApps@2022-01-01-preview' = {
properties: {
configuration: {
environmentVariables: [
{
name: 'ASPNETCORE_ENVIRONMENT'
value: 'Production'
}
]
}
}
} This makes sure the app runs in 5. GitHub Actions (CI/CD Pipelines)If you're using GitHub Actions for deploying, you can add the environment variable in your workflow YAML file. Here’s how: jobs:
build-and-deploy:
steps:
- name: Deploy to Azure
run: |
az containerapp update --name <app-name> \
--resource-group <resource-group> \
--set-env-vars "ASPNETCORE_ENVIRONMENT=Production" So Basically:No more |
Beta Was this translation helpful? Give feedback.
-
Azure Portal Environment variable settings will be reset every time we deploy, isn't it? |
Beta Was this translation helpful? Give feedback.
-
How to specify EnvironmentName when deploying to Azure Container App?
When we are running Aspire on local computer, we can specify it in launchsettings.json.
Is there something like publishProfile for Aspire AppHost?
Beta Was this translation helpful? Give feedback.
All reactions