Refactor SetupRunner to Correctly Handle Managed Identity in Azure vs External Hosting Scenarios#42
Merged
mengyimicro merged 2 commits intomainfrom Nov 24, 2025
Conversation
… External Hosting Scenarios
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the A365SetupRunner to correctly handle three distinct hosting scenarios: Azure-hosted deployments (with managed identity), blueprint-only mode (reusing existing managed identity), and external hosting (no managed identity). The changes introduce explicit separation of these modes through the externalHosting and useManagedIdentity variables, ensuring that Managed Identity and Federated Identity Credential creation only occur when appropriate.
Key Changes:
- Introduced
externalHostingvariable to distinguish external hosting from blueprint-only mode - Added
useManagedIdentityparameter toCreateAgentBlueprintAsyncto control FIC creation - Updated configuration loading logic to handle external hosting differently from blueprint-only mode
src/Microsoft.Agents.A365.DevTools.Cli/Services/A365SetupRunner.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Services/A365SetupRunner.cs
Outdated
Show resolved
Hide resolved
Josina20
approved these changes
Nov 24, 2025
tmlsousa
approved these changes
Nov 24, 2025
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.
This PR refactors A365SetupRunner to correctly separate the behavior of Azure-hosted deployments, blueprint-only mode, and external (non-Azure) hosting.
Previously, both blueprint-only and external hosting paths flowed through the same logic, causing the managed identity (MSI) logic to be reused incorrectly.
This change introduces clear separation and ensures that Managed Identity, Federated Identity Credential (FIC), and Azure infra provisioning occur only when appropriate.
** Store managedIdentityPrincipalId in a365.generated.config.json.
** Create Federated Identity Credential (FIC) in CreateAgentBlueprintAsync.