Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wbreza opened this issue Oct 19, 2023 · 0 comments · Fixed by #2896
Closed
Assignees

Comments

@wbreza
Copy link
Contributor

wbreza commented Oct 19, 2023

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

@wbreza wbreza self-assigned this Oct 19, 2023
wbreza added a commit that referenced this issue Oct 23, 2023
… set environment variables (#2896)

Fixes #2895 & #1910

When main.parameters.json references an empty or not set value expression azd will prompt the user for a value unless the parameter also defines a default value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant