Skip to content

Add a365 network gsa enable|disable|status - #495

Closed
Lala Sushant Srivastava (lasrivas) wants to merge 2 commits into
feature/network-vnet-linkfrom
feature/gsa-environment-setting
Closed

Lala Sushant Srivastava (lasrivas) wants to merge 2 commits into
feature/network-vnet-linkfrom
feature/gsa-environment-setting

Conversation

@lasrivas

@lasrivas Lala Sushant Srivastava (lasrivas) commented Sep 15, 2026

Copy link
Copy Markdown

Adds a365 network gsa enable, disable, and status, so a tenant admin can turn Global Secure Access on or off for the Agent 365 environment.

Global Secure Access is a per-environment Power Platform setting, and Agent 365 does not publish the id of the managed environment it provisions, so the admin surfaces that take an environment id cannot reach it. The platform resolves the environment and applies the change; these commands carry no environment identifier at all.

Depends on the platform routes in bic/MCP-Platform#3686.

Stacked on #494 (a365 network vnet), which it bases on for NetworkCommand.cs. Merge that one first.

Summary

  • Services/GsaService.cs + IGsaService.cs — calls /agents/gsa/{enable,disable,status}; correlation id, typed error bodies, a wall-clock convergence wait, and tenant-targeted authentication resolved from IAzureCliService.
  • Models/GsaModels.csGsaStatusResponse, GsaErrorResponse.
  • Commands/NetworkCommand.cs — a gsa subcommand tree beside vnet, plus ReportGsaAsync as the testable seam holding the wait-and-exit-code logic.
  • Program.cs — DI registration and the new CreateCommand argument.
  • docs/commands/network-gsa.md, a docs/commands/README.md row, and a CHANGELOG entry.
  • Tests: Services/GsaServiceTests.cs and GSA cases in Commands/NetworkCommandTests.cs.

Non-obvious decisions

Tokens are requested for the tenant of the current az login, not just a login hint. A hint alone leaves the authority at common, and the Windows broker then ignores the hint and returns whichever account Windows prefers — silently, since the UPN mismatch is only logged at Debug. For a tenant-wide setting that means applying the change to the wrong tenant. Both the tenant and the user come from a single az account show via IAzureCliService, the same source vnet link already uses, rather than a --tenant-id option the caller would have to keep in sync with their az context. Passing the tenant also arms the mismatch self-heal already present in AuthenticationService, which is inert while tenantId is null. No az login now fails with a clear message instead of guessing.

status takes no --operation-id, unlike vnet status. Power Platform applies the change asynchronously but issues no operation id for it, so there is no handle to poll — the CLI converges by re-reading the setting instead.

NotConfigured is reported distinctly from Disabled. A tenant that has never set the value has not turned it off, and the distinction changes what an admin should do next.

A pending change exits 0. The platform accepted it and the environment is catching up; a non-zero exit would break scripts that chain on success. --wait is how a caller blocks on convergence.

409 gets its own message. A governing Power Platform policy owns the setting, and retrying cannot fix it, so the CLI says so rather than letting it read as transient.

Testing

Full CLI suite: 2120 passed, 0 failed, 12 skipped.

End to end against a real tenant, with the platform running locally on feature/gsa-environment-setting: status → Disabled, enable --wait → Enabled, status → Enabled, enable again → Enabled (no-op), disable --wait → Disabled, status → Disabled, disable again → Disabled (no-op). The environment was left in its original Disabled state.

Global Secure Access is a per-environment Power Platform setting, and Agent 365
does not publish the id of the managed environment it provisions, so the admin
surfaces that take an environment id cannot reach it. The platform resolves the
environment and applies the change; these commands carry no environment
identifier at all.

Two things that are not obvious from the diff:

Power Platform applies the change asynchronously but issues no operation id for
it, so unlike vnet there is no handle to poll. The CLI converges by re-reading
the setting, which is why status takes no --operation-id.

NotConfigured is reported distinctly from Disabled. A tenant that has never set
the value has not turned it off, and the distinction changes what an admin
should do next.

Co-authored-by: Copilot <[email protected]>
Copilot AI lite review requested due to automatic review settings September 15, 2026 19:06
@github-actions

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions github-actions Bot added documentation Improvements or additions to documentation feature labels Sep 15, 2026
@lasrivas
Lala Sushant Srivastava (lasrivas) changed the base branch from main to feature/network-vnet-link September 15, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

GsaService asked for a token with a login hint but no tenant, so the
authority stayed `common`. The Windows broker ignores the hint in that
case and returns whichever account Windows prefers; the resulting UPN
mismatch is only logged at Debug, so a tenant-wide setting could be
applied to the wrong tenant without any visible warning. Passing the
tenant also arms the existing mismatch self-heal in AuthenticationService,
which is inert while tenantId is null.

Resolve both tenant and user from a single `az account show` via
IAzureCliService - the same source `vnet link` already uses - rather
than adding a --tenant-id option the user would have to keep in sync
with their az context. No az login, or an account with no tenant, now
fails with a clear message instead of silently guessing.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants