Skip to content

[ResilienceManagement] RO update commands (namespace: resilience) - #3352

Open
adishiritwick wants to merge 48 commits into
microsoft:mainfrom
adishiritwick:adishi/enhanceROupdate
Open

[ResilienceManagement] RO update commands (namespace: resilience)#3352
adishiritwick wants to merge 48 commits into
microsoft:mainfrom
adishiritwick:adishi/enhanceROupdate

Conversation

@adishiritwick

@adishiritwick adishiritwick commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds recovery-group and pre/post action management to the Azure Resilience Management toolset (Azure.Mcp.Tools.ResilienceManagement, command namespace resilience).

This PR extends resilience recoveryplan create so it can create, replace, and remove additional recovery groups and configure pre/post actions for both the default group and additional groups. Existing recovery-plan settings are preserved during sparse updates when the corresponding options are omitted.

The command remains destructive (Destructive = true), idempotent (Idempotent = true), and not read-only (ReadOnly = false) because it creates or updates recovery-plan configuration using PUT semantics.

This is PR 3 of the rollout plan in [#3241 ]

Command updated:

#Recovery Plan

  • resilience recoveryplan create (RecoveryPlans_CreateOrUpdate)
  • Creates a recovery plan with a generated default recovery-group identifier.
  • Updates the default recovery-group description while preserving its identifier.
  • Creates, replaces, reorders, or removes additional recovery groups.
  • Requires additional-group order IDs to be unique and sequential starting at 1.
  • Accepts an optional group GUID and preserves existing group identifiers by GUID or order when omitted.
  • Rejects duplicate group identifiers and identifiers matching the default recovery group.
  • Preserves existing additional groups when --additional-groups is omitted.
  • Removes all additional groups when --additional-groups '[]' is supplied.

#Recovery Group Actions

  • Supports pre-actions and post-actions on the default recovery group.
  • Supports pre-actions and post-actions inside each additional recovery-group definition.
  • Preserves an existing action list when the corresponding action property or option is omitted.
  • Clears an action list when an empty array is supplied.
  • Supports ManualAction for customer-completed recovery steps.
  • Supports CustomRunbook for Azure Automation runbook execution.
  • Accepts optional Custom Runbook string parameters, including null.
  • Requires Custom Runbook actions to provide a complete Azure Automation runbook resource ID.
  • Validates action names as 3 to 24 characters containing only letters, numbers, or hyphens.
  • Allows empty action instructions and limits non-empty instructions to 100 characters.
  • Requires a positive whole-number timeout.
  • Maps action names, instructions, timeout, resource ID, and parameters into the Azure SDK recovery-group action models.
  • Also includes unit and service tests covering group creation, replacement, removal, identifier preservation, identifier collisions, action mapping, sparse updates, empty action lists, empty instructions, null Custom Runbook parameters, and invalid action payloads. Recorded live tests and test-proxy assets are updated, along with command documentation, end-to-end prompts, and a changelog entry.

#Validation completed:

  • AOT/trimming analysis passed with 0 warnings and 0 affected assemblies.
  • Recorded live and playback tests passed (18/18).
  • Service tests passed (67/67).
  • ToolDescriptionEvaluator ranked resilience_recoveryplan_create first for all 9/9 prompts, with a minimum score of 0.604196.
  • Release build, formatting, and warning-level analyzer checks passed.

Tool Selection Analysis Setup

Setup completed: 2026-08-23 01:17:06
Tool count: 351
Database setup time: 2.6544743s


Tool Selection Analysis Results

Analysis Date: 2026-08-23 01:17:06
Tool count: 351

Table of Contents


Test 1

Expected Tool: resilience_recoveryplan_create
Prompt: Create a Zonal recovery plan named <recovery_plan_name> in service group <service_group>

Results

Rank Score Tool Status
1 0.623542 resilience_recoveryplan_create EXPECTED
2 0.613503 resilience_recoveryplan_get
3 0.547204 resilience_recoveryplan_delete
4 0.529576 resilience_recoveryplan_checkreadiness
5 0.483614 resilience_recoveryplan_resource_update

Test 2

Expected Tool: resilience_recoveryplan_create
Prompt: Set up a Zonal recovery plan named <recovery_plan_name> in service group <service_group>. Use a system-assigned managed identity, description <plan_description>, and default recovery group description <default_group_description>

Results

Rank Score Tool Status
1 0.706855 resilience_recoveryplan_create EXPECTED
2 0.600600 resilience_recoveryplan_get
3 0.572714 resilience_recoveryplan_checkreadiness
4 0.544586 resilience_recoveryplan_delete
5 0.542453 resilience_recoveryplan_resource_update

Test 3

Expected Tool: resilience_recoveryplan_create
Prompt: Create Zonal recovery plan <recovery_plan_name> in service group <service_group> and attach user-assigned managed identity <user_assigned_identity_resource_id>. Use <plan_description> for the plan description and <default_group_description> for the default recovery group

Results

Rank Score Tool Status
1 0.735955 resilience_recoveryplan_create EXPECTED
2 0.563766 resilience_recoveryplan_get
3 0.538747 resilience_recoveryplan_resource_update
4 0.529181 resilience_recoveryplan_checkreadiness
5 0.519963 resilience_recoveryplan_delete

Test 4

Expected Tool: resilience_recoveryplan_create
Prompt: Change recovery plan <recovery_plan_name> in service group <service_group> to a system-assigned managed identity and description <plan_description>. Keep its Zonal plan type and existing recovery groups

Results

Rank Score Tool Status
1 0.676889 resilience_recoveryplan_create EXPECTED
2 0.563036 resilience_recoveryplan_get
3 0.561104 resilience_recoveryplan_resource_update
4 0.516959 resilience_recoveryplan_delete
5 0.510465 resilience_recoveryplan_checkreadiness

Test 5

Expected Tool: resilience_recoveryplan_create
Prompt: Split recovery plan <recovery_plan_name> in service group <service_group> into its default recovery group and one additional group described as <additional_group_description>. Preserve its existing plan type and managed identity

Results

Rank Score Tool Status
1 0.651421 resilience_recoveryplan_create EXPECTED
2 0.553572 resilience_recoveryplan_resource_update
3 0.552780 resilience_recoveryplan_get
4 0.537374 resilience_recoveryplan_delete
5 0.493349 resilience_recoveryplan_checkreadiness

Test 6

Expected Tool: resilience_recoveryplan_create
Prompt: Update recovery plan <recovery_plan_name> in service group <service_group>. Add a manual pre-action named <manual_action_name> with timeout <timeout_minutes> to the default group, and add a post-action script using Automation runbook <runbook_resource_id> to additional recovery group <recovery_group_id>. Preserve its existing plan type and managed identity

Results

Rank Score Tool Status
1 0.683478 resilience_recoveryplan_create EXPECTED
2 0.633293 resilience_recoveryplan_resource_update
3 0.566389 resilience_recoveryplan_get
4 0.532079 resilience_recoveryplan_checkreadiness
5 0.507568 resilience_recoveryplan_delete

Test 7

Expected Tool: resilience_recoveryplan_create
Prompt: Add a pre-action to the default group of recovery plan <recovery_plan_name> in service group <service_group>. I have not chosen the action values yet. Explain the accepted values and ask me for the action type, name, optional description, timeout, and any runbook-specific values one at a time before updating the plan. Preserve its existing plan type and managed identity

Results

Rank Score Tool Status
1 0.634608 resilience_recoveryplan_create EXPECTED
2 0.569846 resilience_recoveryplan_resource_update
3 0.511477 resilience_recoveryplan_get
4 0.505720 resilience_recoveryplan_checkreadiness
5 0.465074 resilience_recoveryplan_delete

Test 8

Expected Tool: resilience_recoveryplan_create
Prompt: Change a system-assigned recovery plan <recovery_plan_name> in service group <service_group> to use a user-assigned managed identity

Results

Rank Score Tool Status
1 0.604196 resilience_recoveryplan_create EXPECTED
2 0.498657 resilience_recoveryplan_resource_update
3 0.491096 resilience_recoveryplan_get
4 0.461829 resilience_recoveryplan_delete
5 0.461003 resilience_recoveryplan_checkreadiness

Test 9

Expected Tool: resilience_recoveryplan_create
Prompt: Update recovery plan <recovery_plan_name> in service group <service_group> to use both its system-assigned identity and user-assigned managed identity <user_assigned_identity_resource_id>. Preserve its existing plan settings

Results

Rank Score Tool Status
1 0.633853 resilience_recoveryplan_create EXPECTED
2 0.562311 resilience_recoveryplan_resource_update
3 0.493914 resilience_recoveryplan_get
4 0.477623 resilience_recoveryplan_checkreadiness
5 0.457788 resilience_recoveryplan_delete

Summary

Total Prompts Tested: 9
Analysis Execution Time: 3.9054768s

Success Rate Metrics

Top Choice Success: 100.0% (9/9 tests)

Confidence Level Distribution

💪 Very High Confidence (≥0.8): 0.0% (0/9 tests)
🎯 High Confidence (≥0.7): 22.2% (2/9 tests)
✅ Good Confidence (≥0.6): 100.0% (9/9 tests)
👍 Fair Confidence (≥0.5): 100.0% (9/9 tests)
👌 Acceptable Confidence (≥0.4): 100.0% (9/9 tests)
❌ Low Confidence (<0.4): 0.0% (0/9 tests)

Top Choice + Confidence Combinations

💪 Top Choice + Very High Confidence (≥0.8): 0.0% (0/9 tests)
🎯 Top Choice + High Confidence (≥0.7): 22.2% (2/9 tests)
✅ Top Choice + Good Confidence (≥0.6): 100.0% (9/9 tests)
👍 Top Choice + Fair Confidence (≥0.5): 100.0% (9/9 tests)
👌 Top Choice + Acceptable Confidence (≥0.4): 100.0% (9/9 tests)

Success Rate Analysis

🟢 Excellent - The tool selection system is performing exceptionally well.

📈 Recommendation: Consider optimizing tool descriptions to achieve higher confidence scores (≥0.8).

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

@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.

@adishiritwick adishiritwick changed the title Adishi/enhance r oupdate [ResilienceManagement] RO update commands (namespace: resilience) Aug 22, 2026

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

Extends the Azure Resilience Management toolset with a new recovery plan readiness check, richer recovery plan create/update capabilities (additional groups and actions), and a breaking rename of the recovery plan/job command groups to single-word names for tool/command consistency.

Changes:

  • Added recoveryplan checkreadiness command with new readiness result models and service implementation.
  • Enhanced recoveryplan create to accept/validate JSON for additional recovery groups and pre/post actions, and wired the new inputs through the service layer.
  • Renamed command groups to recoveryplan and recoveryjob, updating consolidated tool mappings, docs, prompts, and test infrastructure accordingly.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.ResilienceManagement/tests/test-resources.bicep Makes test resource naming more deterministic via a new baseName parameter.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/test-resources-post.ps1 Improves post-deploy provisioning robustness, adds RBAC assignment, and makes goal assignment/drill creation idempotent.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/Services/ResilienceManagementServiceTests.cs Adds unit coverage for readiness helpers (timeouts, polling, recovery job ID parsing) and recovery group behavior.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/ResilienceManagementCommandTests.cs Updates live/integration-style tests to use the renamed tool IDs and adds readiness coverage.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/Recovery/Plans/RecoveryPlanUpdateResourcesCommandTests.cs Adds test coverage for UTF-8 payload byte-limit enforcement.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/Recovery/Plans/RecoveryPlanCreateCommandTests.cs Expands tests for additional groups and action validation/forwarding.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/Recovery/Plans/RecoveryPlanCheckReadinessCommandTests.cs New unit tests for the checkreadiness command behavior and error mapping.
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 readiness polling and extends recovery plan creation to support groups/actions.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Services/IResilienceManagementService.cs Extends service contract for groups/actions and adds readiness API.
tools/Azure.Mcp.Tools.ResilienceManagement/src/ResilienceManagementSetup.cs Registers new command and applies the breaking command group renames.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Options/Recovery/Plans/RecoveryPlanCreateOption.cs Adds options and detailed descriptions for group/action JSON inputs.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Options/Recovery/Plans/RecoveryPlanCheckReadinessOption.cs New options for readiness command.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Models/RecoveryPlanReadinessResult.cs New readiness result DTO.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Models/RecoveryPlanReadinessFailedTask.cs New DTO for readiness failed tasks.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Models/RecoveryPlanReadinessFailedResource.cs New DTO for readiness failed resources.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Models/RecoveryPlanReadinessError.cs New DTO for readiness error details.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Models/RecoveryPlanGroupInput.cs New DTO for additional group inputs.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Models/RecoveryPlanGroupActionKind.cs New enum describing supported action kinds.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Models/RecoveryPlanGroupActionInput.cs New DTO for action inputs (manual and runbook).
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/ResilienceManagementJsonContext.cs Registers readiness result type for source-generated JSON serialization.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/Recovery/Plans/RecoveryPlanUpdateResourcesCommand.cs Enforces payload size limit by UTF-8 bytes rather than string length.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/Recovery/Plans/RecoveryPlanCreateCommand.cs Parses/validates JSON group/action inputs and forwards them to the service.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/Recovery/Plans/RecoveryPlanCheckReadinessCommand.cs New command to run readiness checks and return structured readiness results.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Updates mappings for renamed tools and adds a consolidated tool for readiness checks.
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Updates prompts for renamed tools and adds prompts for readiness checks and group/action scenarios.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Updates CLI docs for renamed groups and documents new readiness command and create options.
servers/Azure.Mcp.Server/changelog-entries/resilience-recovery-plan-commands.yaml Adds changelog entries for new features and breaking renames.
.vscode/cspell.json Adds new command/group terms to spelling allowlist.

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

Comment thread servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json
Comment thread servers/Azure.Mcp.Server/docs/azmcp-commands.md Outdated
Comment thread servers/Azure.Mcp.Server/docs/azmcp-commands.md Outdated
# Conflicts:
#	tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/assets.json
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