Skip to content

azd should prompt for parameter value when referenced environment variable is not set #2895

@wbreza

Description

@wbreza

Consider the following main.parameters.json :

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "environmentName": {
      "value": "${AZURE_ENV_NAME}"
    },
    "location": {
      "value": "${AZURE_LOCATION}"
    },
    "principalId": {
      "value": "${AZURE_PRINCIPAL_ID}"
    },
    "catalogToken": {
      "value": "${GITHUB_TOKEN}"
    }
  }
}

In the above example the catalogToken parameter is required and does NOT have a default value. If the referenced environment variable GITHUB_TOKEN is not set then this would resolve to an empty string parameter value.

This will satisfy the bicep parameter but is not the intended experience. Instead if the parameter is required AND the parameter does not specify a default value azd should prompt the user for a value.

Repro Steps:

  1. Use a main.parameters.json file that specifies a parameter that references a environment variable.
  2. Ensure this environment variable is NOT set either in your shell or azd
  3. Run azd provision for the project

Expected:
azd should prompt the user to specify a value for the parameter

Actual:
azd does NOT prompt the user and an empty string is passed along as the parameter value

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions