Skip to content

[agentfabric] Add Agent Fabric CLI extension - #10370

Open
Kshitija Murudi (kmurudi) wants to merge 15 commits into
Azure:mainfrom
kmurudi:kmurudi-add-agent-fabric
Open

Kshitija Murudi (kmurudi) wants to merge 15 commits into
Azure:mainfrom
kmurudi:kmurudi-add-agent-fabric

Conversation

@kmurudi

@kmurudi Kshitija Murudi (kmurudi) commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Adds the preview Agent Fabric extension generated from the final public Microsoft.NetworkSecurity 2026-10-07-preview contract on RPSaaSMaster.

Authoritative generation sources

  • Final REST API: Azure/azure-rest-api-specs-pr#30665, merged as a52c4fc4ac8cd197d38a1072704853f485cafb6c.
  • OpenAPI: specification/networksecurity/resource-manager/Microsoft.NetworkSecurity/agentFabric/preview/2026-10-07-preview/agentFabric.json.
  • OpenAPI SHA-256: 6de5cd31bbf92e418b5946074bcb3591ca8d30b538521cdf30cd6c24fa35d508.
  • AAZ models: Azure/aaz#1095 at 5ca157eba98d8f3b846e77df92d4944ebf060555.
  • The 36 generated Python files match the independently generated AAZ artifact byte-for-byte.

Customer-facing commands

  • az agentfabric: create/show/list/update/delete/wait.
  • az agentfabric member: create/show/list/update/delete/wait.
  • az agentfabric aks: attach/show/list/update/detach/wait over Cluster Association ARM resources.
  • az agentfabric egress-trust-bundle: read-only show/list for egressTrustBundles/default.
  • az agentfabric policy-group: independent peer-resource create/show/list/update/delete/wait.

Final contract behavior

  • Fabric PUT supports system-assigned identity and customer-owned Content Safety endpoint/API-key pairs through -p/--inspection-profile/--content-inspection-profile. The API key remains write-only and is absent from GET/list/wait/LRO output. Root PATCH remains tags and identity only.
  • Member workloads support ACI, AKS, and AgentFabricSandbox. Final ACI workloads add optional agentIdentity; ACI and Agent Fabric Sandbox identities require tenant/agent IDs when supplied and accept optional blueprintId.
  • resourceGuid and memberGuid use final UUID typing. Member PATCH remains tags plus FQDN; workload is immutable after creation.
  • Endpoint mappings use servicePort, protocol, and targetPort; the removed single port field is not exposed.
  • aks update performs GET-before-PATCH to preserve the immutable target resource ID required for linked authorization. Gateway IP uses -i/--gateway-ip/--workload-cluster-gateway-ip and remains PATCH-only, intentionally absent from attach/show/list output.
  • Cluster Associations support both managed AKS clusters and ACI Sandbox Groups through the shared clusterResourceId contract without inventing another REST operation or discriminator.
  • All five Policy Group policy variants remain fully modeled: FQDN filtering, URL filtering, MCP, TLS inspection, and content inspection.
  • Provider Operations and OperationStatus are client/polling infrastructure, not public commands.

The extension remains preview 1.0.0b1 with minimum CLI 2.75.0. src/index.json and all src/agentmesh source/metadata are identical to live main; published Agent Mesh index withdrawal/source removal is handled separately by #10369/#10371. No private namespace patches, deployment changes, CODEOWNERS changes, or invented documentation URL are included.


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az agentfabric

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Validation

  • python -m pytest src\agentfabric\azext_agentfabric\tests\latest\test_agentfabric.py scripts\ci\test_index.py -q: 20 passed, 2 skipped, 12 subtests passed using the built wheel in a complete Azure CLI dev environment.
  • azdev style agentfabric: passed (pylint and flake8).
  • azdev linter agentfabric --include-whl-extensions --min-severity medium --ci-exclusions: passed, zero violations with the extension's source exclusions loaded.
  • Canonical AAZ parity: 36/36 generated Python files byte-identical to the final artifact from [agentfabric] Add Agent Fabric command models aaz#1095; AAZ Verify Metadata passed.
  • Python compileall, extension JSON parsing, wheel/source generated-file parity, and git diff --check: passed.
  • Wheel build/install: passed. agentfabric-1.0.0b1-py3-none-any.whl, 92,798 bytes, SHA-256 6fe5ee081f59e7ad9278991bce8c45c7ce3fb093049c4d4ac23e2e6a353c6a27.
  • Installed-wheel help smoke: 31/31 group, command, and wait help surfaces passed; generated examples also parsed through the CLI TestSDK.
  • Contract coverage includes final API version/method/URL routing, ACI and sandbox identities with optional blueprint IDs, UUID member input, AKS payloads, endpoint mappings, Content Safety secret omission, GET-before-PATCH ID preservation, PATCH-only gateway IP, all policy variants, and egress trust-bundle output.
  • src/index.json and src/agentmesh: no diff from live main.
  • Live Azure control-plane calls were not run; the pinned API contract does not prove regional service deployment.

Copilot AI lite review requested due to automatic review settings September 21, 2026 03:42
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Kshitija Murudi (@kmurudi),
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

@yonzhan

Copy link
Copy Markdown
Collaborator

agentfabric

@necusjz

Copy link
Copy Markdown
Member

it is not a good practice to modify two moudles in one pr, let's split them.

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 review overview

🟡 Changes recommended

Add or carry over the Agent Fabric help recording required by the test scenarios.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

This PR replaces the Agent Mesh source with the generated Agent Fabric extension while preserving src/index.json.

Changes:

  • Adds Agent Fabric, member, and policy-group CRUD/wait commands.
  • Updates packaging, metadata, documentation, tests, and service mapping.
  • Removes obsolete Agent Mesh source.
  • Critical review blocker (1 vote): Agent Fabric help tests require a missing test_agentfabric_command_help.yaml recording at lines 158 and 172.
File Summary
src/​service_name.json Updates service mapping for Agent Fabric.
src/​agentmesh/​README.md Removes obsolete documentation.
src/​agentmesh/​HISTORY.rst Removes obsolete release history.
src/​agentmesh/​azext_agentmesh/​tests/​latest/​test_agentmesh.py Removes obsolete tests.
src/​agentmesh/​azext_agentmesh/​tests/​latest/​recordings/​test_agentmesh_command_help.yaml Removes the Agent Mesh help recording; an Agent Fabric replacement is required.
src/​agentmesh/​azext_agentmesh/​aaz/​latest/​agentmesh/​fabric/​member/​__cmd_group.py Removes the obsolete command group.
src/​agentmesh/​azext_agentmesh/​aaz/​latest/​agentmesh/​__init__.py Removes the obsolete generated initializer.
src/​agentfabric/​setup.py Defines Agent Fabric package metadata.
src/​agentfabric/​setup.cfg Adds package configuration.
src/​agentfabric/​README.md Documents Agent Fabric commands and resource hierarchy.
src/​agentfabric/​linter_exclusions.yml Updates command exclusions.
src/​agentfabric/​HISTORY.rst Adds Agent Fabric release history.
src/​agentfabric/​azext_agentfabric/​tests/​latest/​test_agentfabric.py Adds validation tests; help-surface scenarios lack the required recording at lines 158 and 172.
src/​agentfabric/​azext_agentfabric/​tests/​latest/​__init__.py Initializes the latest test package.
src/​agentfabric/​azext_agentfabric/​tests/​__init__.py Initializes the test package.
src/​agentfabric/​azext_agentfabric/​custom.py Adds the custom command module.
src/​agentfabric/​azext_agentfabric/​commands.py Adds the command loader.
src/​agentfabric/​azext_agentfabric/​azext_metadata.json Configures preview status and minimum CLI version.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​_wait.py Adds policy-group wait operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​_update.py Adds policy-group update operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​_show.py Adds policy-group show operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​_list.py Adds policy-group list operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​_delete.py Adds policy-group delete operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​_create.py Adds policy-group create operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​__init__.py Registers policy-group commands.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​policy_group/​__cmd_group.py Registers the policy-group command group.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​_wait.py Adds member wait operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​_update.py Adds member update operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​_show.py Adds member show operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​_list.py Adds member list operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​_delete.py Adds member delete operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​_create.py Adds member create operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​__init__.py Registers member commands.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​member/​__cmd_group.py Registers the member command group.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​_wait.py Adds Agent Fabric wait operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​_update.py Adds Agent Fabric update operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​_show.py Adds Agent Fabric show operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​_list.py Adds Agent Fabric list operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​_delete.py Adds Agent Fabric delete operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​_create.py Adds Agent Fabric create operation.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​__init__.py Registers root commands.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​agentfabric/​__cmd_group.py Registers the root command group.
src/​agentfabric/​azext_agentfabric/​aaz/​latest/​__init__.py Initializes the latest API package.
src/​agentfabric/​azext_agentfabric/​aaz/​__init__.py Initializes the generated AAZ package.
src/​agentfabric/​azext_agentfabric/​_params.py Adds argument loading.
src/​agentfabric/​azext_agentfabric/​_help.py Adds extension help loading.
src/​agentfabric/​azext_agentfabric/​__init__.py Registers the Agent Fabric command loader.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/agentfabric/azext_agentfabric/tests/latest/test_agentfabric.py
@kmurudi
Kshitija Murudi (kmurudi) marked this pull request as draft September 21, 2026 04:04
@kmurudi Kshitija Murudi (kmurudi) changed the title Replace Agent Mesh source with Agent Fabric [add agentfabric] [agentfabric] Add Agent Fabric CLI extension Sep 21, 2026
@kmurudi

Copy link
Copy Markdown
Contributor Author

Agreed. This PR is now draft and is being rewritten to add only the new agentfabric module. The agentmesh source removal is moving to a separate ready PR; the index withdrawal already merged in #10369.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Generate from RPSaaSDev 01be2263f53dd57906029e65115a9e475624be74 and Azure/aaz 27db6b454c340f5f46a6a9700fa4c6eee8c9d647. Preserve target identity before association PATCH and cover latest payload contracts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@teresaritorto Teresa Ritorto (teresaritorto) added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Oct 19, 2026
@x-engineering-agent

x-engineering-agent Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

X Engineering Agent Report

Review — Comments

Kshitija Murudi (@kmurudi)

Static review found no actionable defects across release metadata, generated-code ownership, command/help surfaces, request/response mappings, tests, scope, and domain edge cases. No linked issue requires resolution.

Upstream CI reports 24 completed checks, 23 passing, with no failures or pending checks. Author-provided assertions cover payload mappings, secret-output exclusion, and GET-before-PATCH ordering/error propagation. I did not run tests, reproduce generator parity, or verify live service availability.

Copilot feedback

Comment 4059130123 is resolved at this head: the help cassette and the examples cassette both exist and match the test methods' names. The test framework selects recordings by method name. These cassettes record command-tree lookup, not Agent Fabric service operations.

Test validation
  • Agent live test: Not run; this is a review-only PR. Check author-provided test evidence and upstream CI separately.
  • Regression coverage: Not applicable to the changed files.
Risk assessment — 100/100 · Critical

The Critical rating is driven by security-sensitive behavior, public CLI behavior, dependency or supply chain and 2 additional signal(s).

  • Change scope: 55 changed files, 11757 changed lines (+11757 / -0), including 44 production files.
  • Affected components: agentfabric
  • Risk drivers: security-sensitive behavior (+28); public CLI behavior (+18); dependency or supply chain (+18); failure-handling behavior (+12); generated output (+12)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is required for agentfabric before merge.

Posted by x-engineering-agent (Reviewer)

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Kshitija Murudi (@kmurudi) Ready for human review. See the X Engineering Agent Report.

@x-engineering-agent x-engineering-agent Bot added X Engineering Agent Reviewed Agent reviewed this PR and removed Request X Engineering Agent Ask the agent to triage this issue or review this PR labels Oct 19, 2026
@JaysonTaiMicrosoft

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@JaysonTaiMicrosoft

Copy link
Copy Markdown
Contributor

Kshitija Murudi (@kmurudi)

  1. Please sync your branch with main to fix the linter errors in CI
  2. Please also add scenario tests for the ALL commands added for sufficient test coverage. Refer to the following for scenario test guidelines https://github.com/Azure/azure-cli/blob/dev/doc/authoring_tests.md#automating-tests-for-azure-cli

Record public Central US EUAP Fabric, Member, Policy Group, and egress singleton operations. Preserve explicit skipped scenarios for ClusterConnectionInformationUnavailable and ResourceReadFailed service blockers, with ordered disposable-resource cleanup and signed operation URL scrubbing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment on lines +195 to +209
@unittest.skip("Public Central US EUAP attach fails with ClusterConnectionInformationUnavailable.")
@ResourceGroupPreparer(name_prefix="clitestafaks", location=LOCATION, random_name_length=24)
def test_agentfabric_aks_member_lifecycle(self, resource_group):
self.kwargs.update({
"fabric": self.create_random_name(prefix="cliaf", length=24),
"aks": self.create_random_name(prefix="cliafaks", length=24),
"association": self.create_random_name(prefix="cliafassoc", length=24),
"member": self.create_random_name(prefix="cliafmember", length=24),
"location": LOCATION,
})
with ExitStack() as cleanup:
self._exercise_aks_member_lifecycle(cleanup)

@unittest.skip("Public Central US EUAP collection GET fails with ResourceReadFailed.")
@ResourceGroupPreparer(name_prefix="clitestafetblist", location=LOCATION)

@JaysonTaiMicrosoft JaysonTaiMicrosoft Oct 20, 2026 •

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.

Kshitija Murudi (@kmurudi) Please advise why these scenario tests are skipped? Are the commands only actionable on a specific subscription setup? If yes, please mark the test appropriately with either live_only or record_only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correction to my preceding reply: the AKS recording attempt enabled managed identity, but did not explicitly enable managed Microsoft Entra ID authentication (--enable-aad). These are different cluster settings. The user identified earlier testing where enabling Entra ID unblocked enrollment, so the HTTP 502 alone is not sufficient evidence of a service rollout defect—it may reflect an unmet cluster authentication prerequisite in the test setup.

The AKS skip therefore remains a coverage gap to resolve by recording with an Entra-enabled AKS cluster, rather than simply waiting for a rollout. If that supported setup passes, the appropriate change is to encode its prerequisites in the scenario, remove the skip, commit the genuine recording, and verify playback. I have not yet recorded that corrected setup and am not claiming those five positive paths pass. The independently reproduced egress collection HTTP 404 remains separate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Follow-up: managed Entra authentication was the missing AKS prerequisite. With a new disposable cluster created using --enable-managed-identity --enable-aad, the public 2026-10-07-preview attach, show, list, Standard→Premium update, waits, and detach all succeeded in Central US EUAP.

Pushed aa0e6c704: removed the AKS skip, added test_agentfabric_aks_lifecycle.yaml, and documented the Entra requirement in custom attach help and README without editing generated requests. The recording contains genuine successful AKS lifecycle requests/responses and teardown from that live run. An unrelated later Kubernetes deployment command failed RBAC in the original combined scenario; the focused AKS test excludes that workload command (Member CRUD has its own passing recorded scenario). A separate fresh rerun encountered the subscription's resource-group quota, so it was not substituted for the successful trace. No HTTP success responses were fabricated; signed polling values are scrubbed consistently.

Full playback: 20 passed, 1 skipped, plus 12 subtests; style and linter passed. Actual successful recordings now cover 21/22 API commands and all four waits. All newly created scenario resource groups and AKS node groups were confirmed removed; retained user resources were not touched.

Only az agentfabric egress-trust-bundle list remains skipped: its live collection GET returned HTTP 404 ResourceReadFailed while singleton show succeeded. That independent gap still needs the collection endpoint fixed and a successful recording. The earlier classification of AKS attach as a rollout defect was incorrect; it was a test setup prerequisite.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the remaining egress collection scenario in 56c3d48fc to the testsdk @live_only() marker, replacing the unconditional unittest.skip. Verified it skips offline and is enabled when live mode is selected; style checks passed. It still asserts a successful collection response, so a live run will expose the known ResourceReadFailed rather than mask it. AKS lifecycle remains a normal recorded/replayable scenario with Entra authentication, not live-only or skipped. We can remove the egress marker and commit a successful fixture once the collection endpoint is available.

Document managed Entra authentication prerequisite in custom attach help, remove the AKS scenario skip, and replay genuine successful enrollment calls. Keep Kubernetes workload operations separate and redact signed AKS polling URL parameters.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the unconditional skip with the testsdk live_only marker so offline playback stays deterministic while live runs expose the outstanding ResourceReadFailed endpoint failure.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the recorded Container Service API explicitly for the AKS prerequisite and cleanup, independent of the core CLI default. Preserve all real recordings and Agent Fabric request matching, and cover the pin with a regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

X Engineering Agent Reviewed Agent reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants