Watch Aspire live streamsDocsTry Aspire

ContainerEnvVarConstruct

Classsealednet10.0
📦 Aspire.Hosting.Radius v13.6.0-preview.1.26478.8
Represents a single environment-variable entry in a container's env block.
namespace Aspire.Hosting.Radius.Publishing.Constructs;
public sealed class ContainerEnvVarConstruct
: Azure.Provisioning.Primitives.ProvisionableConstruct
{
// ...
}
ProvisionableConstruct
The Radius container schema models env as a map keyed by the variable name, where each entry is an object carrying either a value or a valueFrom source. The two forms are mutually exclusive: assign ContainerEnvVarConstruct.Value or the ContainerEnvVarConstruct.SecretName / ContainerEnvVarConstruct.SecretKey pair, never both.

The value form is emitted for values that carry nothing sensitive. It ends up verbatim in the Kubernetes Deployment spec, so a credential emitted this way is readable by anyone who can read the Deployment or its rollout history — even when the Bicep composed it from an @secure() parameter, which only keeps it out of the published artifact.

The valueFrom.secretKeyRef form points at a key of a Radius.Security/secrets resource; secretName is that resource's name, which the secrets recipe also uses as the Kubernetes Secret name. The container recipe emits these entries ahead of the plain value ones so kubelet's $(VAR) expansion can reference them.

See: https://github.com/radius-project/radius/blob/main/eng/design-notes/extensibility/2025-08-container-resource-type.md and Compute/containers/containers.yaml in radius-project/resource-types-contrib.
View all constructors
View all properties