Skip to content

Azure containerapp compose create does not read unset environment variable defaults #32606

@jackroc97

Description

@jackroc97

Describe the bug

Bug Description

I am building a containerapp using az containerapp compose create. My compose file's environment section declares several variables that are to be read in from environment variables, many of which have default values. Rather than using the default value for unset environment variables, the command uses the literal string of the variable reference as the value.

Example

Say this is the compose file:

environment:
  VAR_A: ${VAR_A}
  VAR_B: ${VAR_B:-foo}
  VAR_C: ${VAR_C:-bar}

And my locally set environment variables are:

VAR_A=hello
VAR_B=world
# VAR_C intentionally left un-set

Azure will read my environment variables as:

"env": [
  {
     "name": "VAR_A",
     "value": "hello"
  },
  {
     "name": "VAR_B",
     "value": "world"
  },
  {
     "name": "VAR_C",
     "value": "${VAR_C:-bar}" // BUG: This should be "bar" since VAR_C was not set
  },
]

Related command

az containerapp compose create

Errors

Please see description

Issue script & Debug output

Please see description.

Expected behavior

Default values for un-declared env variables referenced in the compose file should be interpreted correctly.

Environment Summary

azure-cli 2.81.0
containerapp extension 1.3.0b1

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botContainerAppService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions