docs: comprehensive environment variables documentation#7039
Conversation
There was a problem hiding this comment.
Pull request overview
Expands azd’s documentation to provide a comprehensive reference for environment variables used across the CLI (and related components), and adds contributor guidance to keep the reference updated over time.
Changes:
- Expanded
cli/azd/docs/environment-variables.mdfrom a short list into a multi-section reference covering many more variables. - Added maintenance guidelines to
cli/azd/AGENTS.mdto ensure new/changed env var usage is reflected in the docs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| cli/azd/docs/environment-variables.md | Replaces the minimal env var list with a sectioned, table-based reference covering core Azure, config, extensions, auth, telemetry, CI/CD, debug, and test variables. |
| cli/azd/AGENTS.md | Adds documentation standards requiring updates to the env var reference when os.Getenv / os.LookupEnv usage changes. |
Comments suppressed due to low confidence (1)
cli/azd/docs/environment-variables.md:100
AZD_UI_NO_PROMPT_DIALOGis enabled by checking whether the variable is non-empty (os.Getenv(...) != ""), not via boolean parsing. With the current behavior,AZD_UI_NO_PROMPT_DIALOG=falsewould still disable the dialog, so the description should be “if set” (or mention presence-based semantics) rather than “if true”.
| `AZD_UI_NO_PROMPT_DIALOG` | If true, disables prompt dialog UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JeffreyCA
left a comment
There was a problem hiding this comment.
Thanks for updating this - I had no idea we supported so many variables 😅
wbreza
left a comment
There was a problem hiding this comment.
📋 Code Review — PR #7039
Thanks for taking the time to better our docs! This is a solid effort expanding environment variable documentation from ~12 to 100+ entries.
I verified the documented variables against the codebase and found high accuracy — all documented env vars are confirmed present in the source code.
✅ What Looks Good
- All documented env vars verified against the codebase with 100% accuracy
- Prior review feedback from Copilot and @JeffreyCA has been thoroughly addressed
- Excellent organization into 14 well-structured sections
- AGENTS.md maintenance guidelines set a great precedent for keeping docs current
- Debug and Test sections properly marked with unsupported/internal-only warnings
Summary
| Priority | Count |
|---|---|
| Medium | 2 |
| Low | 2 |
| Total | 4 |
Overall Assessment: Approve — minor suggestions for completeness and precision.
0e085b8 to
359e067
Compare
wbreza
left a comment
There was a problem hiding this comment.
Code Review — PR #7039 (Re-review)
Prior Review Resolution
9 of 13 review comments across all reviewers have been verified as addressed:
JeffreyCA's 5 comments: All applied ✅ (AZD_ALPHA_ENABLE_ALL, agents section, TRACEPARENT/TRACESTATE wording, UPDATE_SNAPSHOTS, AZURE_RECORD_MODE)
Copilot bot's 4 comments: All applied ✅ (extension vars organization, AZD_AUTH_CERT format, AZD_EXT_TIMEOUT format, AZD_ALLOW_NON_EMPTY_FOLDER semantics)
Prior wbreza findings: 2 of 4 addressed:
- ✅ Extension-specific section organization — resolved
⚠️ AZURE_APP_SERVICE_DASHBOARD_URIdescription (actually .NET Aspire dashboard) — still pending⚠️ MissingCODESPACESenv var — still pending⚠️ DEPLOYMENT_STACKS_BYPASSprecision — still pending
These are minor and can be addressed in a follow-up if desired.
✅ What Looks Good
- Comprehensive expansion from ~12 to 100+ variables across 14 well-organized sections
- 100% codebase accuracy — all documented env vars verified against source
- AGENTS.md maintenance guidelines set a great precedent for keeping docs current
- Excellent responsiveness to review feedback — 9 of 13 comments addressed
Overall Assessment: Approve — great docs contribution. Minor pending items can be follow-ups.
Review performed with GitHub Copilot CLI
359e067 to
7d2aa9c
Compare
7d2aa9c to
800b1f4
Compare
Add lessons learned from recent PR reviews (#7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039) as agent instructions to prevent recurring review findings. New sections: - Error handling: ErrorWithSuggestion completeness, telemetry service attribution, scope-agnostic messages - Architecture boundaries: pkg/project target-agnostic, extension docs - Output formatting: shell-safe paths, consistent JSON contracts - Path safety: traversal validation, quoted paths in messages - Testing best practices: test actual rules, extract shared helpers, correct env vars, TypeScript patterns, efficient dir checks - CI/GitHub Actions: permissions, PATH handling, artifact downloads, prefer ADO for secrets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
800b1f4 to
ae95867
Compare
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ae95867 to
fce6bcc
Compare
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
fce6bcc to
c9abf3a
Compare
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
jongio
left a comment
There was a problem hiding this comment.
Documentation Accuracy Review
Verified documented env vars against source code. The PR is a great comprehensive expansion — found 4 items where the docs don't quite match the code's actual parsing semantics.
| Severity | Count |
|---|---|
| MEDIUM | 4 |
Positive findings:
- Excellent organization into 14 well-structured sections
- All prior reviewer feedback (13 threads) addressed
AZD_ALLOW_NON_EMPTY_FOLDERcorrectly says "If set" (presence-based) — nice attention to detailAZD_EXT_TIMEOUTformat/default callout is accurate and helpful
Expand environment-variables.md from ~12 variables to 100+ organized into 14 sections. Add AGENTS.md maintenance guidelines for keeping env var docs in sync with code changes. Fixes #6652 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move AZD_SERVER, AZD_ACCESS_TOKEN, AZD_NO_PROMPT, AZD_ENVIRONMENT, AZD_CWD to Extension Variables section with accurate descriptions - Fix AZD_AUTH_CERT description: base64-encoded DER cert, not a path - Add format/defaults for AZD_EXT_TIMEOUT (integer seconds, default 5s) and AZD_EXTENSION_CACHE_TTL (Go duration, default 4h) - Fix AZD_ALLOW_NON_EMPTY_FOLDER: presence-based, not boolean parsed - Add OIDCREQUESTURI to global cspell dictionary Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply corrections from JeffreyCA and Copilot review: - Fix AZD_AUTH_CERT description (base64 DER, not path) - Clarify AZD_EXT_TIMEOUT units (seconds) and AZD_EXTENSION_CACHE_TTL format - Fix AZD_ALLOW_NON_EMPTY_FOLDER to presence-based semantics - Clarify extension framework vars (AZD_SERVER, AZD_ACCESS_TOKEN) - Add AZD_ALPHA_ENABLE_ALL - Move azure.ai.agents vars to Extension-Specific section - Fix TRACEPARENT/TRACESTATE descriptions - Add UPDATE_SNAPSHOTS, fix AZURE_RECORD_MODE description Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix AZD_UI_NO_PROMPT_DIALOG: presence-checked, not boolean - Fix FORCE_COLOR: exact '1' check, not generic boolean - Add AZD_COPILOT_CLI_PATH to tool path variables - Add AZD_DEPLOY_TIMEOUT to general configuration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
132d02a to
c506593
Compare
jongio
left a comment
There was a problem hiding this comment.
PR Review - #7039
docs: comprehensive environment variables documentation by @spboyer
Summary
What: Expands environment-variables.md from ~12 variables to 100+ organized into 14 sections, adds AGENTS.md maintenance guidelines for keeping docs in sync when env var usage changes.
Why: Closes the documentation gap (fixes #6652) so developers and CI operators have a single reference for all azd env vars.
Assessment: Solid docs contribution. The 14-section organization is logical, descriptions are accurate against source code, and all 17 prior review threads have been addressed. Two minor test-only variables are absent from the Test Variables section.
Findings
| Category | Critical | High | Medium | Low |
|---|---|---|---|---|
| Quality | 0 | 0 | 0 | 1 |
| Total | 0 | 0 | 0 | 1 |
Key Findings
- [LOW] Quality: Two test-infrastructure env vars (
AZURE_DEV_CI_OS,RECORDER_PROXY_DEBUG) aren't in the Test Variables section.
Test Coverage Estimate
N/A - documentation-only PR, no code changes.
What's Done Well
- All documented env vars verified accurate against source code (parsing semantics, defaults, descriptions all match)
- Prior reviewer feedback (17 threads from 4 reviewers) thoroughly addressed
- Clear separation between user-facing, extension, debug, and test variables
- AGENTS.md maintenance guideline establishes a good convention for keeping docs current
1 inline comment below.
Expand
environment-variables.mdfrom ~12 variables to 100+ organized into 14 sections covering all env vars used by azd. Add AGENTS.md maintenance guidelines.Recreated from #6653 (auto-closed by inactivity bot) with updates for new variables added since.
Fixes #6652