Ability to set ASPNETCORE_ENVIRONMENT while executing azd up / azd deploy
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
If we set the ASPNETCORE_ENVIRONMENT environment variable manually, it gets overridden in the subsequent deployments (versions). Is there a way to make it sticky without involving `infra synth` (Bicep)?

**PS:** We tried using a custom build-configuration (e.g. to STAGING_RELEASE) to set this environment-var dynamically using `.WithEnvironment()` approach, but it looks like `azd up`/`azd deploy` doesn't accept any argument to specify the build-configuration (similar to `dotnet build -c|--configuration`) and it looks like it's [hardcoded](https://github.com/Azure/azure-dev/pull/3443/files) to [`Release`](https://github.com/Azure/azure-dev/issues/3436#issuecomment-1965170718).
### Expected Behavior
Static/Sticky ASPNETCORE_ENVIRONMENT (we want to maintain `staging` vs. `production` apps similar to deployment-slots in AzWebApps/AzFunctions) that doesn't get removed/overridden with every deployment.
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version info
_No response_
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.