Fix agentBlueprintClientSecret being nulled out on subsequent setup blueprint runs#302
Merged
meghanshubhatt merged 3 commits intomainfrom Mar 6, 2026
Merged
Conversation
…quent setup blueprint runs Co-authored-by: sellakumaran <147754920+sellakumaran@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix client secret overwrite in generated config
Fix agentBlueprintClientSecret being nulled out on subsequent Mar 2, 2026
setup blueprint runs
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where running a365 setup blueprint a second time on an existing blueprint would overwrite agentBlueprintClientSecret to null in a365.generated.config.json, rendering the blueprint unusable. The root cause was that the intermediate save created a new JsonObject with only explicitly listed fields, omitting the client secret fields.
Changes:
- Replace the
new JsonObjectconstruction pattern with in-place mutation of the existinggeneratedConfigobject, preserving all pre-existing fields includingagentBlueprintClientSecretandagentBlueprintClientSecretProtected - Add two regression tests verifying that the merge pattern preserves existing config fields and initializes
resourceConsentswhen absent
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupSubcommands/BlueprintSubcommand.cs |
Replace new JsonObject with in-place mutation of generatedConfig, fixing the field-dropping bug |
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Commands/BlueprintSubcommandTests.cs |
Add regression tests for the merge pattern preserving existing fields and initializing missing resourceConsents |
sellakumaran
approved these changes
Mar 6, 2026
ajmfehr
approved these changes
Mar 6, 2026
sellakumaran
approved these changes
Mar 6, 2026
sellakumaran
previously approved these changes
Mar 6, 2026
sellakumaran
approved these changes
Mar 6, 2026
gwharris7
approved these changes
Mar 6, 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.
Running
a365 setup blueprinta second time on an existing blueprint overwritesagentBlueprintClientSecrettonullina365.generated.config.json, rendering the blueprint unusable.Root Cause
SetupBlueprintAsyncrebuilds the generated config as acamelCaseConfigJsonObjectand writes it directly to disk as an intermediate step before deciding whether to create a new client secret. This object preservedmanagedIdentityPrincipalIdandresourceConsentsfrom the existing config, but omittedagentBlueprintClientSecretandagentBlueprintClientSecretProtected. When the existing secret validates successfully,CreateBlueprintClientSecretAsync(and itsSaveStateAsynccall) is correctly skipped — leaving the file with no secret.Fix
Preserve the existing secret fields in the intermediate write, consistent with the other passthrough fields:
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.