Skip to content

Add Azure Backup MCP ToolSet - Drop1 - #2116

Merged
Shraddha Jain (shrja-ms) merged 59 commits into
microsoft:mainfrom
shrja-ms:users/shrja/AzureBackup-Drop1
Apr 17, 2026
Merged

Shraddha Jain (shrja-ms) merged 59 commits into
microsoft:mainfrom
shrja-ms:users/shrja/AzureBackup-Drop1

Conversation

@shrja-ms

Copy link
Copy Markdown
Contributor

What does this PR do?

Summary

Adds the Azure Backup MCP toolset with 15 commands covering Recovery Services vaults, Data Protection backup vaults, backup policies, protected items, jobs, recovery points, governance, and disaster recovery operations.

Changes

New Toolset: Azure.Mcp.Tools.AzureBackup

15 commands across 7 command groups:

Group Command Description
Vault azurebackup_vault_get List/get Recovery Services and Backup Vaults
Vault azurebackup_vault_create Create a Recovery Services vault
Vault azurebackup_vault_update Update vault properties (redundancy, soft delete, immutability)
Policy azurebackup_policy_get List/get backup policies for a vault
Policy azurebackup_policy_create Create backup policies for VMs, SQL, SAP HANA, Blobs, Disks, PostgreSQL
Protected Item azurebackup_protecteditem_get List/get protected (backed up) items
Protected Item azurebackup_protecteditem_protect Enable backup protection for a resource
Protectable Item azurebackup_protectableitem_list List resources available for backup
Backup azurebackup_backup_status Check backup status for an Azure resource
Job azurebackup_job_get List/get backup and restore jobs
Recovery Point azurebackup_recoverypoint_get List/get recovery points for a protected item
Governance azurebackup_governance_find-unprotected Find unprotected Azure resources
Governance azurebackup_governance_immutability Check vault immutability configuration
Governance azurebackup_governance_soft-delete Check vault soft delete configuration
DR azurebackup_dr_enablecrr Enable cross-region restore on a vault

Architecture

  • Dual-stack support: Both Recovery Services (RSV) and Data Protection (DPP) vault types
  • Datasource registry pattern: Extensible RsvDatasourceRegistry and DppDatasourceRegistry for workload-specific operations
  • Service layer: AzureBackupService orchestrates RSV and DPP operations through RsvBackupOperations and DppBackupOperations
  • AOT-safe: All models registered in AzureBackupJsonContext

Test Coverage

  • 99 unit tests covering all 15 commands (success, error, input validation, deserialization)
  • 6 live integration tests (vault get/list, policy list, governance checks, job list)
  • 30 e2e test prompts in e2eTestPrompts.md

Documentation & Compliance

  • Updated azmcp-commands.md with full Azure Backup command reference
  • Updated e2eTestPrompts.md with 30 test prompts
  • Updated README.md with Azure Backup in services list
  • Added CODEOWNERS entry
  • Added 7 consolidated tool groups to consolidated-tools.json
  • Created changelog entry
  • Created test-resources.bicep and test-resources-post.ps1 for live test infrastructure
  • Created LiveTests project with assets.json for recording support
  • Spelling check passes
  • Tool metadata verified via Update-AzCommandsMetadata.ps1

Files Changed

  • 105 files changed, 10,801 insertions
  • Source: 18 files under tools/Azure.Mcp.Tools.AzureBackup/src/
  • Unit Tests: 15 test files under tests/Azure.Mcp.Tools.AzureBackup.UnitTests/
  • Live Tests: tests/Azure.Mcp.Tools.AzureBackup.LiveTests/
  • Test Infrastructure: test-resources.bicep, test-resources-post.ps1
  • Docs: azmcp-commands.md, e2eTestPrompts.md, README.md
  • Config: CODEOWNERS, consolidated-tools.json, Microsoft.Mcp.slnx, Azure.Mcp.Server.slnx

Validation

  • dotnet build - 0 errors, 0 warnings
  • dotnet test - 99/99 unit tests pass
  • Live tests - 6/6 pass against deployed mcplive-rsv vault
  • Invoke-Cspell.ps1 - Spelling check passes
  • Update-AzCommandsMetadata.ps1 - Tool metadata up to date
  • Changelog entry created
  • CODEOWNERS updated
  • Consolidated tools updated

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.
Azure Backup Documentation: https://learn.microsoft.com/en-us/azure/backup/

GitHub issue number?

#2035

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
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • 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 using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • 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 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

Implements the first subset of Azure Backup MCP tools with 15 commands:
- Vault: get (consolidated get+list), create, update
- Policy: get (consolidated get+list), create
- Protected Item: get (consolidated get+list), protect
- Protectable Item: list
- Backup: status
- Job: get (consolidated get+list)
- Recovery Point: get (consolidated get+list)
- Governance: find-unprotected, immutability, soft-delete
- DR: enablecrr

Key design decisions:
- Consolidated get+list into single 'get' commands with optional identifier
- Full service layer included for extensibility in future drops
- Dual vault architecture (RSV + Backup vault) with auto-detection
- 99 unit tests covering all 15 commands

Infrastructure changes:
- Added Azure.ResourceManager.RecoveryServices 1.1.1
- Added Azure.ResourceManager.RecoveryServicesBackup 1.3.0
- Added Azure.ResourceManager.DataProtectionBackup 1.7.0
- Registered AzureBackupSetup in Program.cs and both slnx files
…nfrastructure

- Remove 227 code comments from 18 source files
- Add Azure Backup section to azmcp-commands.md
- Add 30 e2e test prompts to e2eTestPrompts.md
- Update README.md with Azure Backup service listing
- Add CODEOWNERS entry for Azure Backup toolset
- Add 7 consolidated tool groups to consolidated-tools.json
- Add changelog entry YAML
- Create test-resources.bicep and test-resources-post.ps1
- Create LiveTests project with 6 integration tests (vault, policy, governance, job)
- Add assets.json for test proxy recording support
- Update Microsoft.Mcp.slnx and Azure.Mcp.Server.slnx with LiveTests project
- All 99 unit tests pass, all 6 live tests pass (6/6)

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 a new Azure Backup MCP toolset to the Azure MCP Server, including command implementations, option/model types, service orchestration (RSV + DPP), and accompanying unit/live tests and documentation updates.

Changes:

  • Introduces Azure.Mcp.Tools.AzureBackup area with commands for vaults, policies, protection, jobs, recovery points, governance, and DR.
  • Adds unit tests + recorded live tests plus test-resource deployment scripts.
  • Registers the new area in Azure.Mcp.Server, updates command docs/prompts, consolidated tools mapping, CODEOWNERS, and shared package versions.

Reviewed changes

Copilot reviewed 105 out of 105 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.AzureBackup/tests/test-resources.bicep Adds Bicep template for Azure Backup test resources
tools/Azure.Mcp.Tools.AzureBackup/tests/test-resources-post.ps1 Post-deploy script for test resources
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Vault/VaultUpdateCommandTests.cs Unit tests for vault update command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Vault/VaultGetCommandTests.cs Unit tests for vault get/list command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Vault/VaultCreateCommandTests.cs Unit tests for vault create command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/RecoveryPoint/RecoveryPointGetCommandTests.cs Unit tests for recovery point get/list command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/ProtectedItem/ProtectedItemProtectCommandTests.cs Unit tests for protected-item protect command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/ProtectedItem/ProtectedItemGetCommandTests.cs Unit tests for protected-item get/list command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/ProtectableItem/ProtectableItemListCommandTests.cs Unit tests for protectable-item list command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Policy/PolicyGetCommandTests.cs Unit tests for policy get/list command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Policy/PolicyCreateCommandTests.cs Unit tests for policy create command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Job/JobGetCommandTests.cs Unit tests for job get/list command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Governance/GovernanceSoftDeleteCommandTests.cs Unit tests for soft-delete governance command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Governance/GovernanceImmutabilityCommandTests.cs Unit tests for immutability governance command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Governance/GovernanceFindUnprotectedCommandTests.cs Unit tests for find-unprotected governance command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Dr/DrEnableCrrCommandTests.cs Unit tests for enable CRR command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Backup/BackupStatusCommandTests.cs Unit tests for backup status command
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Azure.Mcp.Tools.AzureBackup.UnitTests.csproj Adds unit test project for toolset
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.LiveTests/assets.json Recorded-test assets configuration
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.LiveTests/AzureBackupCommandTests.cs Recorded live tests invoking Azure Backup tools
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.LiveTests/Azure.Mcp.Tools.AzureBackup.LiveTests.csproj Adds live test project
tools/Azure.Mcp.Tools.AzureBackup/src/Services/VaultTypeResolver.cs Adds vault type validation/resolution helpers
tools/Azure.Mcp.Tools.AzureBackup/src/Services/RsvDatasourceRegistry.cs Adds RSV datasource registry for workload mapping
tools/Azure.Mcp.Tools.AzureBackup/src/Services/RsvDatasourceProfile.cs Adds RSV datasource profile + enums
tools/Azure.Mcp.Tools.AzureBackup/src/Services/IRsvBackupOperations.cs RSV operations interface
tools/Azure.Mcp.Tools.AzureBackup/src/Services/IDppBackupOperations.cs DPP operations interface
tools/Azure.Mcp.Tools.AzureBackup/src/Services/DppDatasourceRegistry.cs Adds DPP datasource registry/configuration helpers
tools/Azure.Mcp.Tools.AzureBackup/src/Services/DppDatasourceProfile.cs Adds DPP datasource profile + enums
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultUpdateOptions.cs Options model for vault update
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultListOptions.cs Options model for vault list
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultGetOptions.cs Options model for vault get
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultCreateOptions.cs Options model for vault create
tools/Azure.Mcp.Tools.AzureBackup/src/Options/RecoveryPoint/RecoveryPointListOptions.cs Options model for recovery point list
tools/Azure.Mcp.Tools.AzureBackup/src/Options/RecoveryPoint/RecoveryPointGetOptions.cs Options model for recovery point get
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectedItem/ProtectedItemProtectOptions.cs Options model for protect
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectedItem/ProtectedItemListOptions.cs Options model for protected item list
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectedItem/ProtectedItemGetOptions.cs Options model for protected item get
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectableItem/ProtectableItemListOptions.cs Options model for protectable item list
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Policy/PolicyListOptions.cs Options model for policy list
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Policy/PolicyGetOptions.cs Options model for policy get
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Policy/PolicyCreateOptions.cs Options model for policy create
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Job/JobListOptions.cs Options model for job list
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Job/JobGetOptions.cs Options model for job get
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Governance/GovernanceSoftDeleteOptions.cs Options model for soft-delete
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Governance/GovernanceImmutabilityOptions.cs Options model for immutability
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Governance/GovernanceFindUnprotectedOptions.cs Options model for find-unprotected
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Dr/DrEnableCrrOptions.cs Options model for enable CRR
tools/Azure.Mcp.Tools.AzureBackup/src/Options/BaseProtectedItemOptions.cs Shared protected-item option base
tools/Azure.Mcp.Tools.AzureBackup/src/Options/BaseAzureBackupOptions.cs Shared Azure Backup option base
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Backup/BackupStatusOptions.cs Options model for backup status
tools/Azure.Mcp.Tools.AzureBackup/src/Models/WorkflowResult.cs Adds workflow result models
tools/Azure.Mcp.Tools.AzureBackup/src/Models/VaultCreateResult.cs Adds vault create result model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/UnprotectedResourceInfo.cs Adds governance output model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/RestoreTriggerResult.cs Adds restore trigger result model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/RecoveryPointInfo.cs Adds recovery point model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/ProtectedItemInfo.cs Adds protected item model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/ProtectableItemInfo.cs Adds protectable item model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/ProtectResult.cs Adds protect result model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/OperationResult.cs Adds shared operation result model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/HealthCheckResult.cs Adds health check output models
tools/Azure.Mcp.Tools.AzureBackup/src/Models/DrValidationResult.cs Adds DR validation output model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/CostEstimateResult.cs Adds cost estimate output model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/ContainerInfo.cs Adds container model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/BackupVaultInfo.cs Adds vault info model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/BackupTriggerResult.cs Adds backup trigger result model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/BackupStatusResult.cs Adds backup status model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/BackupPolicyInfo.cs Adds policy model
tools/Azure.Mcp.Tools.AzureBackup/src/Models/BackupJobInfo.cs Adds job model
tools/Azure.Mcp.Tools.AzureBackup/src/GlobalUsings.cs Adds global using for System.CommandLine
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Vault/VaultUpdateCommand.cs Implements vault update command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Vault/VaultGetCommand.cs Implements vault get/list command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Vault/VaultCreateCommand.cs Implements vault create command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/RecoveryPoint/RecoveryPointGetCommand.cs Implements recovery point get/list command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/ProtectedItem/ProtectedItemProtectCommand.cs Implements protected item protect command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/ProtectedItem/ProtectedItemGetCommand.cs Implements protected item get/list command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/ProtectableItem/ProtectableItemListCommand.cs Implements protectable item list command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Policy/PolicyGetCommand.cs Implements policy get/list command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Policy/PolicyCreateCommand.cs Implements policy create command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Job/JobGetCommand.cs Implements job get/list command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Governance/GovernanceSoftDeleteCommand.cs Implements soft-delete governance command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Governance/GovernanceImmutabilityCommand.cs Implements immutability governance command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Governance/GovernanceFindUnprotectedCommand.cs Implements find-unprotected governance command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Dr/DrEnableCrrCommand.cs Implements enable CRR command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/BaseProtectedItemCommand.cs Shared base for protected-item commands
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/BaseAzureBackupCommand.cs Shared base for Azure Backup commands
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Backup/BackupStatusCommand.cs Implements backup status command
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/AzureBackupJsonContext.cs Registers AOT-safe JSON source-gen types
tools/Azure.Mcp.Tools.AzureBackup/src/AzureBackupSetup.cs Registers services + command groups
tools/Azure.Mcp.Tools.AzureBackup/src/Azure.Mcp.Tools.AzureBackup.csproj Adds new tool project and package refs
tools/Azure.Mcp.Tools.AzureBackup/src/AssemblyInfo.cs InternalsVisibleTo for tests
servers/Azure.Mcp.Server/src/Program.cs Registers Azure Backup area in server
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Adds Azure Backup e2e prompts
servers/Azure.Mcp.Server/docs/azmcp-commands.md Adds Azure Backup command reference
servers/Azure.Mcp.Server/changelog-entries/shrja-add-azure-backup-toolset.yaml Adds changelog entry
servers/Azure.Mcp.Server/README.md Adds Azure Backup examples + service listing
servers/Azure.Mcp.Server/Azure.Mcp.Server.slnx Adds Azure Backup projects to solution
core/Microsoft.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json Adds consolidated mappings for Azure Backup tools
Microsoft.Mcp.slnx Adds Azure Backup projects to root solution
Directory.Packages.props Adds ARM SDK package versions for RecoveryServices/DataProtection
.github/CODEOWNERS Adds codeowners entry for Azure Backup toolset

You can also share your feedback on Copilot code review. Take the survey.

Comment thread servers/Azure.Mcp.Server/README.md Resolved
@shrja-ms

Copy link
Copy Markdown
Contributor Author

Copilot add iteration to apply changes based on the comments in this thread

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
- Remove unused tenantId parameter from test-resources.bicep
- Interpolate testApplicationOid in role assignment description
- Split WorkflowResult.cs: move WorkflowStep to its own file
- Split HealthCheckResult.cs: move HealthCheckItemDetail to its own file
Comment thread .github/CODEOWNERS Resolved
- Azure.ResourceManager.RecoveryServicesBackup: 1.3.0 -> 1.3.1
- Azure.ResourceManager.RecoveryServices: 1.1.1 -> 1.2.0
- Azure.ResourceManager.DataProtectionBackup: 1.7.0 -> 1.7.1
- Azure.Core: 1.50.0 -> 1.51.1 (transitive dependency)
- Azure.ResourceManager: 1.13.2 -> 1.14.0 (transitive dependency)
- System.ClientModel: 1.8.0 -> 1.9.0 (transitive dependency)

Resolves CI trim/AOT failures (NETSDK1144/IL2026) caused by
non-AOT-compatible Azure.ResourceManager.RecoveryServicesBackup 1.3.0.
…h command annotations

The consolidated mode validation requires all commands in a group to have
identical ToolMetadata. The backup entries were incorrectly grouping read-only
and write commands together, causing ConsolidatedModeTests to fail in Debug mode.

Restructured 6 backup entries into 3 entries grouped by matching metadata:
- get_azure_backup_details: 8 read-only commands (ReadOnly=true)
- create_azure_backup_resources: 3 create commands (Destructive=true, Idempotent=false)
- update_azure_backup_settings: 4 update commands (Destructive=true, Idempotent=true)
The CI runs recorded tests for LiveTests projects that have assets.json.
With an empty Tag (no recordings), the test proxy returns 404, causing
all 6 LiveTests to fail across 4 platforms (24 failures).

Remove assets.json so Test-Code.ps1 skips recorded tests for AzureBackup.
Will re-add after recording test sessions per docs/recorded-tests.md.
dotnet format --verify-no-changes was failing due to single-line if
statements that should use multi-line formatting per editorconfig.
Auto-fixed 19 files in AzureBackup toolset.

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

This PR introduces the new Azure.Mcp.Tools.AzureBackup toolset and wires it into Azure MCP Server, adding Azure Backup command groups, models/options, test infrastructure (unit + live tests), and documentation/tool metadata updates.

Changes:

  • Added the Azure.Mcp.Tools.AzureBackup area (commands/options/models/services) and registered it in Azure.Mcp.Server.
  • Added unit tests + live tests and test resource deployment scripts/templates.
  • Updated server docs/tooling metadata (azmcp command docs, e2e prompts, consolidated tools, CODEOWNERS, changelog entry, solution files, and package versions).

Reviewed changes

Copilot reviewed 106 out of 106 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.AzureBackup/tests/test-resources.bicep Adds Bicep template to deploy an RSV vault + role assignment for live tests.
tools/Azure.Mcp.Tools.AzureBackup/tests/test-resources-post.ps1 Post-deploy PowerShell hook for test resources.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Vault/VaultUpdateCommandTests.cs Unit tests for vault update command behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Vault/VaultGetCommandTests.cs Unit tests for vault get/list command behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Vault/VaultCreateCommandTests.cs Unit tests for vault create command behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/RecoveryPoint/RecoveryPointGetCommandTests.cs Unit tests for recovery point get/list behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/ProtectedItem/ProtectedItemProtectCommandTests.cs Unit tests for enabling protection for a datasource.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/ProtectedItem/ProtectedItemGetCommandTests.cs Unit tests for protected item get/list behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/ProtectableItem/ProtectableItemListCommandTests.cs Unit tests for listing protectable items.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Policy/PolicyGetCommandTests.cs Unit tests for policy get/list behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Policy/PolicyCreateCommandTests.cs Unit tests for policy creation behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Job/JobGetCommandTests.cs Unit tests for job get/list behavior.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Governance/GovernanceSoftDeleteCommandTests.cs Unit tests for governance soft delete command.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Governance/GovernanceImmutabilityCommandTests.cs Unit tests for governance immutability command.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Governance/GovernanceFindUnprotectedCommandTests.cs Unit tests for finding unprotected resources.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Dr/DrEnableCrrCommandTests.cs Unit tests for enabling cross-region restore.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Backup/BackupStatusCommandTests.cs Unit tests for backup status command.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.UnitTests/Azure.Mcp.Tools.AzureBackup.UnitTests.csproj Adds unit test project for Azure Backup tool.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.LiveTests/AzureBackupCommandTests.cs Adds recorded/live tests calling Azure Backup tools through the server.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.LiveTests/Azure.Mcp.Tools.AzureBackup.LiveTests.csproj Adds live test project for Azure Backup tool.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/VaultTypeResolver.cs Adds vault type constants/helpers and validation.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/RsvDatasourceRegistry.cs Adds RSV datasource profile registry and resolution logic.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/RsvDatasourceProfile.cs Adds enums and profile record for RSV datasource behavior.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/IRsvBackupOperations.cs Defines RSV operations interface surface.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/IDppBackupOperations.cs Defines DPP operations interface surface.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/DppDatasourceRegistry.cs Adds DPP datasource profile registry and instance naming helpers.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/DppDatasourceProfile.cs Adds DPP profile record and enums controlling behavior.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultUpdateOptions.cs Adds options model for vault update.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultListOptions.cs Adds options model for vault list.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultGetOptions.cs Adds options model for vault get.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Vault/VaultCreateOptions.cs Adds options model for vault create.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/RecoveryPoint/RecoveryPointListOptions.cs Adds options model for recovery point list.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/RecoveryPoint/RecoveryPointGetOptions.cs Adds options model for recovery point get.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectedItem/ProtectedItemProtectOptions.cs Adds options model for protected item protect.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectedItem/ProtectedItemListOptions.cs Adds options model for protected item list.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectedItem/ProtectedItemGetOptions.cs Adds options model for protected item get.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ProtectableItem/ProtectableItemListOptions.cs Adds options model for protectable item list.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Policy/PolicyListOptions.cs Adds options model for policy list.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Policy/PolicyGetOptions.cs Adds options model for policy get.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Policy/PolicyCreateOptions.cs Adds options model for policy create.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Job/JobListOptions.cs Adds options model for job list.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Job/JobGetOptions.cs Adds options model for job get.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Governance/GovernanceSoftDeleteOptions.cs Adds options model for soft delete governance command.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Governance/GovernanceImmutabilityOptions.cs Adds options model for immutability governance command.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Governance/GovernanceFindUnprotectedOptions.cs Adds options model for find-unprotected governance command.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Dr/DrEnableCrrOptions.cs Adds options model for enabling CRR.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/BaseProtectedItemOptions.cs Base options for protected-item scoped commands.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/BaseAzureBackupOptions.cs Base options for vault-scoped commands.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Backup/BackupStatusOptions.cs Adds options model for backup status.
tools/Azure.Mcp.Tools.AzureBackup/src/Models/*.cs Adds serialized result models for commands/tool responses.
tools/Azure.Mcp.Tools.AzureBackup/src/GlobalUsings.cs Adds global using for System.CommandLine.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/*Command.cs Implements Azure Backup command handlers.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/AzureBackupJsonContext.cs Registers AOT-safe System.Text.Json source-gen context for tool responses.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/BaseAzureBackupCommand.cs Adds shared option registration/binding for Azure Backup commands.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/BaseProtectedItemCommand.cs Adds shared option registration/binding for protected-item commands.
tools/Azure.Mcp.Tools.AzureBackup/src/AzureBackupSetup.cs Registers DI services and command groups for the Azure Backup area.
tools/Azure.Mcp.Tools.AzureBackup/src/Azure.Mcp.Tools.AzureBackup.csproj Adds Azure Backup tool project + package references.
tools/Azure.Mcp.Tools.AzureBackup/src/AssemblyInfo.cs Exposes internals to unit + live tests.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Adds consolidated tool group mappings for Azure Backup.
servers/Azure.Mcp.Server/src/Program.cs Registers the Azure Backup area in the server startup.
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Adds e2e prompts for Azure Backup tools.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Adds CLI command documentation for Azure Backup commands.
servers/Azure.Mcp.Server/changelog-entries/shrja-add-azure-backup-toolset.yaml Adds changelog entry for Azure Backup toolset.
servers/Azure.Mcp.Server/README.md Adds Azure Backup examples and service listing entry.
servers/Azure.Mcp.Server/Azure.Mcp.Server.slnx Adds Azure Backup projects to server solution.
Microsoft.Mcp.slnx Adds Azure Backup projects to root solution.
Directory.Packages.props Updates Azure SDK package versions and adds required ARM packages for backup.
.github/CODEOWNERS Adds codeowners for the Azure Backup tool area.

- Fix argument order bug in GovernanceSoftDeleteCommand (vaultType and
  softDeleteRetentionDays were swapped in ConfigureSoftDeleteAsync call)
- Make ImmutabilityState, SoftDelete, and WorkloadType options required
  (fixes null-forgiving operator on optional fields)
- Fix test-resources.bicep baseName default to use take() for maxLength safety
- Update e2eTestPrompts.md governance prompts from 'Check' to 'Configure'
- Update unit tests to reflect required option changes
…ning

Replace the stub that returned an empty list with a real implementation that:
1. Lists all Recovery Services and Backup vaults across the subscription
2. Collects datasource ARM IDs from all protected items in every vault
3. Lists generic resources of protectable types (VMs, SQL, Storage, etc.)
4. Returns resources whose IDs are not in the protected set

Also supports optional filtering by resource type, resource group, and tags.

AzureBackupService now extends BaseAzureService (with ITenantService) to
obtain ARM client access for listing generic subscription resources.
…tests

- Remove MySQLFlexible from DPP registry (not a supported datasource type)

- Fix s_protectableResourceTypes: remove Microsoft.Sql (SQL-in-VM is a VM workload), remove MySQL, add ElasticSAN and CosmosDB

- Update WorkloadType and DatasourceType option descriptions

- Rewrite DppBackupOperationsHelperTests to DppDatasourceRegistryTests (fix pre-existing build errors from refactored static methods to registry pattern)

@jongio Jon Gallant (jongio) 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.

Incremental pass since my Apr 14 review. All CHANGES_REQUESTED items are addressed:

  • ResolveVaultTypeAsync catches 401/403 alongside 404 for correct DPP fallthrough
  • OperationCanceledException properly rethrown in Task.WhenAll catch blocks
  • ListProtectableItemsAsync gives a clear error for DPP vaults
  • Regex.IsMatch replaced with [GeneratedRegex] for AOT safety
  • storage-type validated at both command and service level
  • Retention options clearly documented as not yet applied
  • --redundancy added to azmcp-commands.md

Remaining blocker: Build Analyze CI check is still failing (1 error, 1 warning). This needs to pass before merge.

Follow-up items (service-layer integration tests, expanded live test coverage) should be tracked in an issue per alzimmermsft's suggestion.

@jongio Jon Gallant (jongio) 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.

Re-approving - the only change since my last approval is a using statement reorder in AzureBackupService.cs (dotnet format). LGTM.

Bug fixes (11):
- BackupVaultInfo: 14-field constructor with full detail extraction
- BackupPolicyInfo: 8-field constructor with full detail extraction
- AzureBackupService: RG filter, backup status mapping, immutability normalization
- RsvBackupOperations: BackupResourceVaultConfig for soft-delete, SoftDeleteFeatureState mapping, friendly name matching, container auto-discovery, 180s timeout
- DppBackupOperations: MapToVaultInfo/MapToPolicyInfo detail extraction, friendly name matching
- DppDatasourceRegistry: CosmosDB profile (PT4H/Incremental/BackupHourly)
- VaultGetCommand: Pass resourceGroup to ListVaultsAsync
- IAzureBackupService: Add resourceGroup param to ListVaultsAsync

Unit tests: 244 pass, 9 new tests added
Live tests: 43 pass (re-recorded with updated assertions)

@jongio Jon Gallant (jongio) 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.

Looked through this after the existing reviews. Most issues were already caught - these are a few things I didn't see flagged yet.

Note: the 3 existing approvals are stale (latest commit pushed 2026-04-15 after all approvals from 2026-04-14). Reapproval needed before merge.

Comment thread Directory.Packages.props Resolved
- #2: Separate auth errors (401/403) from not-found (404) in
  ResolveVaultTypeAsync and AutoDetectAndExecuteAsync. Auth failures on
  DPP now throw UnauthorizedAccessException with RBAC guidance instead
  of being swallowed as KeyNotFoundException.

- microsoft#4: NormalizeImmutabilityState now throws ArgumentException on
  unrecognized values instead of silently passing them through.

- microsoft#5: Add RsvDatasourceRegistryTests with comprehensive coverage for
  Resolve, ResolveOrDefault, ResolveFromProtectedItemName, and profile
  properties. Add BindOptions_BindsOptionsCorrectly tests to all 15
  command test files. Add service tests for auth error separation and
  invalid immutability state.

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

Copilot reviewed 97 out of 97 changed files in this pull request and generated 1 comment.

Shraddha Jain (shrja-ms) added a commit to shrja-ms/mcp that referenced this pull request Apr 16, 2026
…ove unsupported retention params, rename resource-group-filter, fix VaultGet description, add unit tests

@jongio Jon Gallant (jongio) 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.

Three new observations after deduplicating against the 185 existing inline comments. My 4 comments from Apr 15 (misleading 403-as-404 errors, central package bumps, missing RsvDatasourceRegistry tests, missing BindOptions tests) are still pending - please address those first.

Note: all 3 approvals are stale (latest commit Apr 16, approvals from Apr 14). Reapproval needed. The branch also has merge conflicts to resolve.

@shrja-ms
Shraddha Jain (shrja-ms) enabled auto-merge (squash) April 17, 2026 01:52

@jongio Jon Gallant (jongio) 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.

Reviewed the delta since commit 5eabdf8. VaultGetCommand description is now accurate, the NuGetAuditSuppress removal is safe (10.0.6 is patched, CI audit is green), and the polling loop TODO acknowledges the concern.

On re-reading the full branch: my 4 Apr 15 comments I flagged as still pending in my Apr 16 review are actually all addressed - 401/403 now throws UnauthorizedAccessException with RBAC guidance, package bumps landed at patched versions via the upstream merge, RsvDatasourceRegistryTests exists, and all 15 command test classes have BindOptions tests. My Apr 16 review body was wrong on that point, apologies for the noise.

The two remaining Apr 16 suggestions (RsvBackupOperations at 1277 lines, polling loop up to 180s) are non-blockers and can be tackled in a follow-up.

Approving. Reapproval from Alan Zimmer (@alzimmermsft) and Anannya Patra (@anannya03) is still needed to unblock merge.

@shrja-ms
Shraddha Jain (shrja-ms) merged commit 90d8873 into microsoft:main Apr 17, 2026
15 checks passed
Shraddha Jain (shrja-ms) added a commit to shrja-ms/mcp that referenced this pull request Apr 17, 2026
Follow-up to address deferred review comments from PR microsoft#2116 (Azure Backup MCP ToolSet - Drop1).

Changes:
- Rename command group dr -> disasterrecovery, command enablecrr -> enable-crr
- Rename Commands/Dr/DrEnableCrrCommand -> Commands/DisasterRecovery/DisasterRecoveryEnableCrrCommand
- Rename --resource-group-filter -> --resource-group (uses OptionDefinitions.Common.ResourceGroup)
- Remove unsupported retention params (schedule-frequency, weekly/monthly/yearly retention)
- Fix VaultGetCommand description to reflect optional RG filtering
- Fix AutoDetectAndExecuteAsync error message for RSV auth failure + DPP 404
- Update consolidated-tools.json, changelog entry, architecture.md, azmcp-commands.md, e2eTestPrompts.md
- Remove NuGetAuditSuppress (packages now at patched 10.0.6)
- Fix PolicyCreateOptions trailing blank line
Shraddha Jain (shrja-ms) added a commit to shrja-ms/mcp that referenced this pull request Apr 17, 2026
Follow-up to address deferred review comments from PR microsoft#2116 (Azure Backup MCP ToolSet - Drop1).

Changes:
- Rename command group dr -> disasterrecovery, command enablecrr -> enable-crr
- Rename Commands/Dr/DrEnableCrrCommand -> Commands/DisasterRecovery/DisasterRecoveryEnableCrrCommand
- Rename --resource-group-filter -> --resource-group (uses OptionDefinitions.Common.ResourceGroup)
- Remove unsupported retention params (schedule-frequency, weekly/monthly/yearly retention)
- Fix VaultGetCommand description to reflect optional RG filtering
- Fix AutoDetectAndExecuteAsync error message for RSV auth failure + DPP 404
- Update consolidated-tools.json, changelog entry, architecture.md, azmcp-commands.md, e2eTestPrompts.md
- Remove NuGetAuditSuppress (packages now at patched 10.0.6)
- Fix PolicyCreateOptions trailing blank line
Shraddha Jain (shrja-ms) added a commit to shrja-ms/mcp that referenced this pull request Apr 17, 2026
Follow-up to address deferred review comments from PR microsoft#2116 (Azure Backup MCP ToolSet - Drop1).

Changes:
- Rename command group dr -> disasterrecovery, command enablecrr -> enable-crr
- Rename Commands/Dr/DrEnableCrrCommand -> Commands/DisasterRecovery/DisasterRecoveryEnableCrrCommand
- Rename --resource-group-filter -> --resource-group (uses OptionDefinitions.Common.ResourceGroup)
- Remove unsupported retention params (schedule-frequency, weekly/monthly/yearly retention) from public and internal ops interfaces
- Fix VaultGetCommand description to reflect optional RG filtering
- Fix AutoDetectAndExecuteAsync error message for RSV auth failure + DPP 404
- Update consolidated-tools.json, changelog entry, architecture.md, azmcp-commands.md, e2eTestPrompts.md
- Fix PolicyCreateOptions trailing blank line
- Rename live test methods/logs to match new naming conventions
- Re-record live tests for renamed methods
Shraddha Jain (shrja-ms) added a commit that referenced this pull request Apr 17, 2026
Follow-up to address deferred review comments from PR #2116 (Azure Backup MCP ToolSet - Drop1).

Changes:
- Rename command group dr -> disasterrecovery, command enablecrr -> enable-crr
- Rename Commands/Dr/DrEnableCrrCommand -> Commands/DisasterRecovery/DisasterRecoveryEnableCrrCommand
- Rename --resource-group-filter -> --resource-group (uses OptionDefinitions.Common.ResourceGroup)
- Remove unsupported retention params (schedule-frequency, weekly/monthly/yearly retention)
- Fix VaultGetCommand description to reflect optional RG filtering
- Fix AutoDetectAndExecuteAsync error message for RSV auth failure + DPP 404
- Update consolidated-tools.json, changelog entry, architecture.md, azmcp-commands.md, e2eTestPrompts.md
- Remove NuGetAuditSuppress (packages now at patched 10.0.6)
- Fix PolicyCreateOptions trailing blank line
Colby Timm (colbytimm) pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Apr 25, 2026
* Add Azure Backup MCP toolset - Drop 1 (15 commands)

Implements the first subset of Azure Backup MCP tools with 15 commands:
- Vault: get (consolidated get+list), create, update
- Policy: get (consolidated get+list), create
- Protected Item: get (consolidated get+list), protect
- Protectable Item: list
- Backup: status
- Job: get (consolidated get+list)
- Recovery Point: get (consolidated get+list)
- Governance: find-unprotected, immutability, soft-delete
- DR: enablecrr

Key design decisions:
- Consolidated get+list into single 'get' commands with optional identifier
- Full service layer included for extensibility in future drops
- Dual vault architecture (RSV + Backup vault) with auto-detection
- 99 unit tests covering all 15 commands

Infrastructure changes:
- Added Azure.ResourceManager.RecoveryServices 1.1.1
- Added Azure.ResourceManager.RecoveryServicesBackup 1.3.0
- Added Azure.ResourceManager.DataProtectionBackup 1.7.0
- Registered AzureBackupSetup in Program.cs and both slnx files

* Fix CONTRIBUTING.md compliance gaps, add LiveTests project and test infrastructure

- Remove 227 code comments from 18 source files
- Add Azure Backup section to azmcp-commands.md
- Add 30 e2e test prompts to e2eTestPrompts.md
- Update README.md with Azure Backup service listing
- Add CODEOWNERS entry for Azure Backup toolset
- Add 7 consolidated tool groups to consolidated-tools.json
- Add changelog entry YAML
- Create test-resources.bicep and test-resources-post.ps1
- Create LiveTests project with 6 integration tests (vault, policy, governance, job)
- Add assets.json for test proxy recording support
- Update Microsoft.Mcp.slnx and Azure.Mcp.Server.slnx with LiveTests project
- All 99 unit tests pass, all 6 live tests pass (6/6)

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* Address PR review comments: split model files, fix Bicep template

- Remove unused tenantId parameter from test-resources.bicep
- Interpolate testApplicationOid in role assignment description
- Split WorkflowResult.cs: move WorkflowStep to its own file
- Split HealthCheckResult.cs: move HealthCheckItemDetail to its own file

* Upgrade Azure Backup packages to AOT-compatible versions

- Azure.ResourceManager.RecoveryServicesBackup: 1.3.0 -> 1.3.1
- Azure.ResourceManager.RecoveryServices: 1.1.1 -> 1.2.0
- Azure.ResourceManager.DataProtectionBackup: 1.7.0 -> 1.7.1
- Azure.Core: 1.50.0 -> 1.51.1 (transitive dependency)
- Azure.ResourceManager: 1.13.2 -> 1.14.0 (transitive dependency)
- System.ClientModel: 1.8.0 -> 1.9.0 (transitive dependency)

Resolves CI trim/AOT failures (NETSDK1144/IL2026) caused by
non-AOT-compatible Azure.ResourceManager.RecoveryServicesBackup 1.3.0.

* Fix consolidated-tools.json: split backup entries by metadata to match command annotations

The consolidated mode validation requires all commands in a group to have
identical ToolMetadata. The backup entries were incorrectly grouping read-only
and write commands together, causing ConsolidatedModeTests to fail in Debug mode.

Restructured 6 backup entries into 3 entries grouped by matching metadata:
- get_azure_backup_details: 8 read-only commands (ReadOnly=true)
- create_azure_backup_resources: 3 create commands (Destructive=true, Idempotent=false)
- update_azure_backup_settings: 4 update commands (Destructive=true, Idempotent=true)

* Fix LiveTests namespace: use Microsoft.Mcp.Tests instead of Azure.Mcp.Tests

* Remove assets.json until test recordings are available

The CI runs recorded tests for LiveTests projects that have assets.json.
With an empty Tag (no recordings), the test proxy returns 404, causing
all 6 LiveTests to fail across 4 platforms (24 failures).

Remove assets.json so Test-Code.ps1 skips recorded tests for AzureBackup.
Will re-add after recording test sessions per docs/recorded-tests.md.

* Apply dotnet format to fix CI Analyze check

dotnet format --verify-no-changes was failing due to single-line if
statements that should use multi-line formatting per editorconfig.
Auto-fixed 19 files in AzureBackup toolset.

* Address Copilot PR review comments

- Fix argument order bug in GovernanceSoftDeleteCommand (vaultType and
  softDeleteRetentionDays were swapped in ConfigureSoftDeleteAsync call)
- Make ImmutabilityState, SoftDelete, and WorkloadType options required
  (fixes null-forgiving operator on optional fields)
- Fix test-resources.bicep baseName default to use take() for maxLength safety
- Update e2eTestPrompts.md governance prompts from 'Check' to 'Configure'
- Update unit tests to reflect required option changes

* Implement FindUnprotectedResourcesAsync with real Azure resource scanning

Replace the stub that returned an empty list with a real implementation that:
1. Lists all Recovery Services and Backup vaults across the subscription
2. Collects datasource ARM IDs from all protected items in every vault
3. Lists generic resources of protectable types (VMs, SQL, Storage, etc.)
4. Returns resources whose IDs are not in the protected set

Also supports optional filtering by resource type, resource group, and tags.

AzureBackupService now extends BaseAzureService (with ITenantService) to
obtain ARM client access for listing generic subscription resources.

* Align datasource types to supported list and fix broken DPP registry tests

- Remove MySQLFlexible from DPP registry (not a supported datasource type)

- Fix s_protectableResourceTypes: remove Microsoft.Sql (SQL-in-VM is a VM workload), remove MySQL, add ElasticSAN and CosmosDB

- Update WorkloadType and DatasourceType option descriptions

- Rewrite DppBackupOperationsHelperTests to DppDatasourceRegistryTests (fix pre-existing build errors from refactored static methods to registry pattern)

* Address Copilot review: validation, naming, docs fixes

- Rename DppBackupOperationsHelperTests.cs to DppDatasourceRegistryTests.cs to match class name

- VaultGetCommand: validate --resource-group is provided when --vault is specified (return 400)

- VaultCreateCommand: validate --vault-type is provided (return 400 with helpful message)

- Fix --redundancy description to use full names (GeoRedundant, LocallyRedundant, etc.)

- Fix e2eTestPrompts: replace invalid AzureStorage with AzureFileShare workload type

- Fix azmcp-commands.md: show --workload-type as required (not optional) for policy create

* Address latest Copilot review: docs alignment, VaultTypeResolver validation, e2e prompts

- Fix vault create docs: --vault-type shown as required (not optional)

- Fix governance docs: --immutability-state and --soft-delete shown as required

- Update README prompts: use 'configure' for destructive ops, include vault-type and location

- VaultTypeResolver.IsVaultTypeSpecified: throw ArgumentException on invalid non-empty vault type

- Fix backup_status e2e prompts: include required --location parameter

* PR standards compliance: fix broken markdown, add assets.json, remove dead code

- Fix azmcp-commands.md: add missing closing code fence after DR section (broke all subsequent markdown)

- Add assets.json for LiveTests (required for recorded test infrastructure)

- Fix e2eTestPrompts: governance find-unprotected use <resource_type> matching actual option name

- Remove 5 unused *ListOptions classes (VaultList, JobList, PolicyList, ProtectedItemList, RecoveryPointList)

* Remove empty assets.json to fix CI recorded test failures

The assets.json with empty Tag causes CI to run recorded tests in Playback mode with no recordings, resulting in 404 errors. Removing until recordings are pushed.

* Fix live test failures: add required governance params and recording sanitizers

- Add missing 'soft-delete' parameter to GovernanceSoftDelete test
- Add missing 'immutability-state' parameter to GovernanceImmutability test
- Add TestMatcher and BodyRegexSanitizers for recorded test infrastructure
- Remove assets.json (empty Tag causes CI Playback failures)

* Address active Copilot review comments: fix validation, IDs, command names, polling

- Remove unused using directives from AzureBackupCommandTests.cs
- Fix ProtectableItemListCommand Id to valid GUID format
- Replace manual BadRequest check with command validator for --vault-type in VaultCreateCommand
- Fix incorrect command name 'azurebackup protectable_item_list' to 'azurebackup protectableitem list' in RsvBackupOperations
- Replace hardcoded Task.Delay(30000) with polling loop for container visibility in VM protection

* Fix azmcp-commands.md section ordering and e2e vault_create prompts

- Move Azure Backup section from middle of App Service section to correct alphabetical position (after App Service, before Azure CLI)
- Add vault-type to e2e vault_create prompts ('rsv' and 'dpp')

* Address PR review comments: parallelize FindUnprotectedResources, use random GUIDs, update changelog

* Fix namespace renames after upstream/main merge: Azure.Mcp.Core.Extensions -> Microsoft.Mcp.Core.Extensions, Azure.Mcp.Core.Commands -> Microsoft.Mcp.Core.Commands

* Fix CI Build Analyze: correct import ordering and restore assets.json

* Fix e2eTestPrompts.md: correct alphabetical section ordering

* Merge upstream/main and fix namespace renames: Azure.Mcp.Core -> Microsoft.Mcp.Core, update tool metadata

* Fix CI Analyze: correct import ordering in all 15 unit test files (System -> Azure -> Microsoft -> NSubstitute -> Xunit)

* Fix LiveTests build: add missing using Microsoft.Mcp.Tests.Generated.Models for CustomDefaultMatcher

* Remove empty assets.json to skip recorded tests until recordings are available

* Add recorded test recordings with populated Tag, add DPP vault to test-resources.bicep

* Remove redundant JsonPropertyName attributes from all model records (camelCase handled by AzureBackupJsonContext)

* Address PR feedback: VaultUpdate validation, GetErrorMessage overrides, trim unused options, expand live+unit test coverage

* Update recorded test assets for expanded live test coverage (12/15 tools)

* Address PR review: remove stub BackupStatus command, replace Task.FromResult stubs with NotImplementedException, fix DrEnableCrr error message, parallelize vault listing

* Implement real BackupStatus command using Azure SDK

Replace the previously removed stub BackupStatus command with a real
implementation that calls the Azure Backup Management Status API via
Azure.ResourceManager.RecoveryServicesBackup SDK.

Changes:
- Implement GetBackupStatusAsync in AzureBackupService using BackupStatusContent
- Re-create BackupStatusCommand and BackupStatusOptions
- Re-register command in AzureBackupSetup, JsonContext, consolidated-tools
- Add comprehensive unit tests (BackupStatusCommandTests)
- Restore docs and e2e test prompts

* Fix DPP implementations, add DPP live tests, address review feedback

- Implement real Azure SDK calls for DPP ConfigureImmutabilityAsync,
  ConfigureSoftDeleteAsync, and ConfigureCrossRegionRestoreAsync
- Fix DPP UpdateVaultAsync to wire soft-delete, immutability, and tags
- Add ConfigureCrossRegionRestoreAsync to IDppBackupOperations
- Route CRR through DPP in AzureBackupService (was hardcoded RSV-only)
- Add 10 DPP live tests covering vault, policy, governance, jobs, DR
- Add GetErrorMessage override to GovernanceFindUnprotectedCommand
- Fix baseName maxLength in test-resources.bicep (24 -> 20)
- Remove development artifacts (PR-Body.md, ManualTestCases.md, etc.)
- Update recorded test assets for 22 live tests (RSV + DPP)

* Address PR review: constructor injection, remove unused interface surface, trim service files

* Address Jon PR review: fix comma-split resourceTypeFilter, TagFilter description, narrow InquireAsync catch, fix GenerateInstanceName duplication, update recordings

* Address Jon review: resilient Task.WhenAll for partial results, validate workload types in DPP/RSV registries, update recordings

* Address Jon review: explicit .AsRequired() for vault, policy, protectedItem, datasourceId, location option registrations

* Address Copilot review: add VM/SQL aliases, fix option descriptions, clarify VaultGet resource-group, fix naming mode comment, fix DatasourceId description

* Address alzimmermsft review: remove redundant JsonPropertyName, use terser new(), add governance/vault validators, fix CRR error message, move VaultGet validation to RegisterOptions

* AzureBackup: Fix tests, remove redundant options, add XML docs and datasource registry improvements

* Address PR review: remove unused usings, add --redundancy to VaultUpdateCommand

* Address PR review comments: vault-type auto-detect fixes, option warnings, service tests

- Fix ResolveVaultTypeAsync/AutoDetectAndExecuteAsync to catch 401/403 alongside 404
  so DPP-only users aren't blocked when RSV probe returns Forbidden/Unauthorized
- Add CollectUnsupportedPolicyOptionWarnings to return Warning in CreatePolicyAsync
  response when unimplemented options (schedule-frequency, weekly/monthly/yearly
  retention) are provided
- Fix OperationCanceledException swallowed in ListVaultsAsync and
  FindUnprotectedResourcesAsync catch-all blocks
- Reject --vault-type=dpp for ListProtectableItemsAsync (RSV-only operation)
- Update option descriptions to clearly state not-yet-applied status
- Update ProtectableItemListCommand description to note RSV-only
- Fix CS0649 build error for BaseAzureService.s_defaultPollInterval in Release builds
- Add AzureBackupServiceTests with 22 tests covering orchestration layer:
  auto-detect fallback (404/403/401), both-stacks-fail, partial ListVaults failure,
  cancellation propagation, unsupported option warnings, vault-type validation
- Re-record all 48 live test sessions with updated assets tag

* Address PR review: input validation, vault-type checks, sealed classes, OData sanitization

- Add vault-type validation ('rsv'/'dpp') in BaseAzureBackupCommand and VaultGetCommand
- Add ParseIdentityType validation in RSV/DPP, identity-type validator in VaultUpdateCommand
- Add soft-delete retention days range (14-180) validators in GovernanceSoftDeleteCommand and VaultUpdateCommand
- Throw NotSupportedException for unsupported policy options instead of silent warning
- Add per-vault try/catch isolation in FindUnprotectedResourcesAsync
- Add ValidateAndParseResourceTypeFilter with regex validation for OData safety
- Harden NormalizeWorkloadTypeForFilter with strict allowlist
- Add ConfigureStorageRedundancyAsync for RSV redundancy updates, throw for DPP
- Apply tags via patchData.Tags in RSV UpdateVaultAsync
- Seal AzureBackupService, RsvBackupOperations, DppBackupOperations, AzureBackupSetup
- Add 47 new unit tests (235 total pass)

* Address PR review: remove custom GetErrorMessage from GovernanceSoftDeleteCommand

- Remove custom GetErrorMessage override per alzimmermsft feedback (default handler provides richer RequestFailedException handling)
- Remove unused 'using System.Net' since HttpStatusCode is no longer referenced
- Update corresponding unit tests to match default error handler messages

* fixed unit tests and resolved other review comments

* Added missing option in azmcp-commands

* dotnet format

* Fix Azure Backup bugs, update unit tests, re-record live tests

Bug fixes (11):
- BackupVaultInfo: 14-field constructor with full detail extraction
- BackupPolicyInfo: 8-field constructor with full detail extraction
- AzureBackupService: RG filter, backup status mapping, immutability normalization
- RsvBackupOperations: BackupResourceVaultConfig for soft-delete, SoftDeleteFeatureState mapping, friendly name matching, container auto-discovery, 180s timeout
- DppBackupOperations: MapToVaultInfo/MapToPolicyInfo detail extraction, friendly name matching
- DppDatasourceRegistry: CosmosDB profile (PT4H/Incremental/BackupHourly)
- VaultGetCommand: Pass resourceGroup to ListVaultsAsync
- IAzureBackupService: Add resourceGroup param to ListVaultsAsync

Unit tests: 244 pass, 9 new tests added
Live tests: 43 pass (re-recorded with updated assertions)

* Address PR review comments microsoft#2, microsoft#4, microsoft#5

- microsoft#2: Separate auth errors (401/403) from not-found (404) in
  ResolveVaultTypeAsync and AutoDetectAndExecuteAsync. Auth failures on
  DPP now throw UnauthorizedAccessException with RBAC guidance instead
  of being swallowed as KeyNotFoundException.

- microsoft#4: NormalizeImmutabilityState now throws ArgumentException on
  unrecognized values instead of silently passing them through.

- microsoft#5: Add RsvDatasourceRegistryTests with comprehensive coverage for
  Resolve, ResolveOrDefault, ResolveFromProtectedItemName, and profile
  properties. Add BindOptions_BindsOptionsCorrectly tests to all 15
  command test files. Add service tests for auth error separation and
  invalid immutability state.

* Merge main and suppress NU1903 for unpatched System.Security.Cryptography.Xml CVEs

* Remove NuGetAuditSuppress for System.Security.Cryptography.Xml - package is pinned to patched 10.0.6

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: anannya03 <[email protected]>
Co-authored-by: Anannya Patra <[email protected]>
Colby Timm (colbytimm) pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Apr 25, 2026
…crosoft#2429)

Follow-up to address deferred review comments from PR microsoft#2116 (Azure Backup MCP ToolSet - Drop1).

Changes:
- Rename command group dr -> disasterrecovery, command enablecrr -> enable-crr
- Rename Commands/Dr/DrEnableCrrCommand -> Commands/DisasterRecovery/DisasterRecoveryEnableCrrCommand
- Rename --resource-group-filter -> --resource-group (uses OptionDefinitions.Common.ResourceGroup)
- Remove unsupported retention params (schedule-frequency, weekly/monthly/yearly retention)
- Fix VaultGetCommand description to reflect optional RG filtering
- Fix AutoDetectAndExecuteAsync error message for RSV auth failure + DPP 404
- Update consolidated-tools.json, changelog entry, architecture.md, azmcp-commands.md, e2eTestPrompts.md
- Remove NuGetAuditSuppress (packages now at patched 10.0.6)
- Fix PolicyCreateOptions trailing blank line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants