Skip to content

[ResilienceManagement] Add create commands (namespace: resilience) - #3166

Open
adishiritwick wants to merge 4 commits into
microsoft:mainfrom
adishiritwick:adishi/createusagepattern
Open

[ResilienceManagement] Add create commands (namespace: resilience)#3166
adishiritwick wants to merge 4 commits into
microsoft:mainfrom
adishiritwick:adishi/createusagepattern

Conversation

@adishiritwick

@adishiritwick adishiritwick commented Jul 28, 2026

Copy link
Copy Markdown

Adds the authoring (create-or-update) commands to the Azure Resilience Management toolset (Azure.Mcp.Tools.ResilienceManagement, command namespace resilience).

This is PR 2 of the rollout plan in #2894 — building on the read-only surface delivered in #2948. It adds create commands across the goal and usage-plan command groups, reusing the toolset plumbing established in PR 1 (IAreaSetup, BaseAzureResourceService, non-standard serviceGroup path-parameter handling, parameter shapes, telemetry, and recorded-test infrastructure). Lifecycle/action commands follow in PR 3.

All commands are create-or-update (ReadOnly = false, Destructive = false, Idempotent = true). Each returns the created/updated resource's details.

Commands added:

Usage Plan
resilience usageplan create (UsagePlans_CreateOrUpdate)
resilience usageplan enrollment create (Enrollments_CreateOrUpdate)
Also includes unit tests, recorded live tests (goal template/assignment, usage plan, enrollment), README/command docs/e2e prompts, and a changelog entry.

GitHub issue number?

[Link to the GitHub issue this PR addresses]

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • Updated test prompts in servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Copilot AI review requested due to automatic review settings July 28, 2026 10:12
@adishiritwick
adishiritwick requested review from a team and g2vinay as code owners July 28, 2026 10:12
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution @adishiritwick! We will review the pull request and get back to you soon.

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.

Pull request overview

Adds Resilience Management “create” operations to the resilience namespace, extending the toolset beyond read-only scenarios by enabling usage plan and enrollment creation via ARM, along with unit/live test coverage and documentation/tooling updates.

Changes:

  • Added azmcp resilience usageplan create and azmcp resilience usageplan enrollment create commands, wired through IResilienceManagementService.
  • Expanded live test infrastructure and added unit/integration tests for the new create commands.
  • Updated Azure MCP Server docs/prompts, consolidated tool mappings, and changelog entry.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.ResilienceManagement/tests/test-resources.bicep Adds outputs for isolated “create” test resource names.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/test-resources-post.ps1 Creates isolated RG/service group for create live tests (note: outside harness-managed RG).
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/UsagePlans/UsagePlanCreateCommandTests.cs New unit tests for usage plan create command validation/results/errors.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/UsagePlans/Enrollments/UsagePlanEnrollmentCreateCommandTests.cs New unit tests for enrollment create command validation/results/errors.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/ResilienceManagementCommandTests.cs Adds live/integration scenarios for creating usage plans and enrollments.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/assets.json Updates recorded-test assets tag.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Services/ResilienceManagementService.cs Implements ARM create/update flows for usage plans and enrollments.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Services/IResilienceManagementService.cs Extends service interface with create APIs.
tools/Azure.Mcp.Tools.ResilienceManagement/src/ResilienceManagementSetup.cs Registers new commands and adds them to command groups.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Options/UsagePlans/UsagePlanCreateOption.cs Adds options for usage plan creation.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Options/UsagePlans/Enrollments/UsagePlanEnrollmentCreateOption.cs Adds options for enrollment creation.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/UsagePlans/UsagePlanCreateCommand.cs New command implementation + error mapping for usage plan create.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/UsagePlans/Enrollments/UsagePlanEnrollmentCreateCommand.cs New command implementation + error mapping for enrollment create.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/ResilienceManagementJsonContext.cs Registers new response models for AOT-safe JSON serialization.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Adds a consolidated “create” tool mapping for the new commands.
servers/Azure.Mcp.Server/README.md Adds example prompts for the new create scenarios.
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Adds E2E prompts for the new tool IDs.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Adds CLI docs for the new create commands.
servers/Azure.Mcp.Server/changelog-entries/1782549900000.yaml Adds changelog entries for the new features.

Comment thread servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json
Comment thread tools/Azure.Mcp.Tools.ResilienceManagement/tests/test-resources-post.ps1 Outdated

@RickWinter RickWinter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Noticed a couple things

# and carries the same Owners/DeleteAfter tags as the managed resource group so subscription-wide
# expiry-based clean-up (see New-TestResources.ps1's DeleteAfterHours) reclaims it automatically.
$managedResourceGroup = Get-AzResourceGroup -Name $ResourceGroupName
New-AzResourceGroup -Name $createResourceGroupName -Location $managedResourceGroup.Location -Tag $managedResourceGroup.Tags -Force | Out-Null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This resource group is created after New-TestResources.ps1 grants the test identity Owner only on the harness-managed resource group. The live tests call the new command as that test identity, so creating a usage plan in $createResourceGroupName will fail with 403 in CI unless the identity already has subscription-wide access. Pass TestApplicationOid into this script and grant it the required role on the new resource group, or keep the create test resources inside the managed group.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed. Please check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants