Add non-Azure hosting support to a365 setup#34
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for non-Azure hosting deployments to the Agent 365 CLI setup flow. It introduces a hostingMode configuration that allows users to choose between Azure App Service hosting (default) and External hosting (e.g., Kubernetes, other clouds). The change enables blueprint and permissions configuration without requiring Azure infrastructure provisioning.
Key changes:
- Added
hostingModeandmessagingEndpointconfiguration properties to support external hosting scenarios - Modified validation logic to be conditional based on hosting mode (Azure vs External)
- Updated setup flow to skip Azure CLI authentication and infrastructure provisioning for non-Azure deployments
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Microsoft.Agents.A365.DevTools.Cli/Services/A365SetupRunner.cs | Added external hosting detection, conditional Azure authentication, and infrastructure provisioning skip logic |
| src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs | Added hostingMode and messagingEndpoint properties with conditional validation and BotName derivation |
| src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs | Added messaging endpoint validation for non-Azure deployments and conditional endpoint registration logic |
src/Microsoft.Agents.A365.DevTools.Cli/Services/A365SetupRunner.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Services/ConfigService.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Services/A365SetupRunner.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Outdated
Show resolved
Hide resolved
- Added `GraphApiService` as a dependency in `SetupCommand` and replaced inline instantiations with dependency injection. - Introduced `GraphTokenScopeException` to handle disallowed high-privilege scopes in Graph tokens. - Implemented `ValidateGraphToken` in `A365SetupRunner` to enforce least-privilege principles during token validation. - Refactored `GetTokenFromGraphClient` to use `Azure.Identity` for token retrieval and validation. - Added new error code `HighPrivilegeScopeDetected` to `ErrorCodes` for better error categorization. - Updated `Program.cs` to inject `GraphApiService` at runtime. - Enhanced unit tests to mock `GraphApiService` and ensure coverage of new functionality. - Removed redundant code and improved exception handling to exclude `Agent365Exception` from generic catch blocks. - Performed general code cleanup and added licensing information to new files.
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Models/Agent365Config.cs
Outdated
Show resolved
Hide resolved
The merge-base changed after approval.
The merge-base changed after approval.
The merge-base changed after approval.
The merge-base changed after approval.
The merge-base changed after approval.
The merge-base changed after approval.
Pull request was converted to draft
This change updates the Agent 365 CLI setup flow to support non-Azure deployments (e.g., external/K8s/other cloud hosts) by:
Introducing a needDeployment and messagingEndpoint configuration.
Allowing blueprint + permissions setup without provisioning Azure App Service resources.
Failing early when required non-Azure settings are missing or invalid.
Reusing the existing messaging endpoint registration flow with external URLs.