fix: reject failed azd environment lookups - #1057
Merged
Roopan-Microsoft merged 1 commit intoAug 28, 2026
Merged
Conversation
Prevent azd error output from being written into App Service settings when optional agent environment keys are missing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the post-provision PowerShell scripts so failed azd env get-value lookups don’t propagate CLI error text into downstream configuration (notably App Service settings), which previously could break API startup.
Changes:
- Validate
azd env get-valuesuccess via$LASTEXITCODEbefore accepting output. - Normalize
azdoutput to a trimmed string and rejectERROR:-prefixed results in both post-provision scripts. - Minor whitespace cleanup in
connect-data.ps1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| infra/scripts/post-provision/setup-agent.ps1 | Adds exit-code checking and output normalization for azd env get-value to avoid syncing error text. |
| infra/scripts/post-provision/connect-data.ps1 | Applies the same azd env get-value hardening (plus small whitespace cleanup). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
MohdRafi-Microsoft
added a commit
that referenced
this pull request
Aug 27, 2026
- setup-data.ps1: remove long wait/retry indexing logic added in PR #1044; restore pre-PR-1044 simple upload/cleanup flow since App Services keep VNet integration regardless of public network toggle. Keep -ResourceGroupName param and RG auto-discovery. - connect-data.ps1, setup-agent.ps1: fix Get-AzdEnvValue error detection (align with PR #1057) and only send USE_SQL/agent settings when valid/non-empty to avoid Pydantic bool validation crash on API startup. - nginx.conf: add client_max_body_size to fix 413 errors on manual UI uploads proxied through the frontend in private-networking mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Hey, thanks for the contribution. We've updated the target branch from main to dev to align with our standard branching workflow. |
Roopan-Microsoft
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
azd env get-valuecalls from writing CLI error text into App Service settings. InvalidUSE_SQLvalues caused Pydantic validation to fail during API startup, leaving the backend unavailable with HTTP 503 responses.azdexit code and normalize output before accepting optional agent settings in both post-provision data paths.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
ERROR: key not found....Other Information
The failure was reproduced in an Azure deployment and recovery was validated with a healthy API plus successful SQL, Search, and Cosmos checks.