Skip to content

Azure Backup: resourceguard command group + MUA disable safety fix - #3322

Merged
Shraddha Jain (shrja-ms) merged 9 commits into
microsoft:mainfrom
shrja-ms:user/azurebackup-resource-guard-mua-safety
Aug 26, 2026
Merged

Azure Backup: resourceguard command group + MUA disable safety fix#3322
Shraddha Jain (shrja-ms) merged 9 commits into
microsoft:mainfrom
shrja-ms:user/azurebackup-resource-guard-mua-safety

Conversation

@shrja-ms

Copy link
Copy Markdown
Contributor

Azure Backup: resourceguard command group + MUA disable safety fix

This PR delivers two related improvements from azurebackup-rsv-mcp-improvements-plan.md in a single change:

PR 3 — New azurebackup resourceguard command group

Adds create, get, and delete operations for Microsoft.DataProtection/resourceGuards, the resource that backs Multi-User Authorization (MUA) on Recovery Services vaults and Backup vaults.

  • azurebackup resourceguard create — provision a new Resource Guard with optional --excluded-operations and --tags
  • azurebackup resourceguard get — retrieve details for a Resource Guard
  • azurebackup resourceguard delete — remove a Resource Guard

The service layer defaults s_mandatoryResourceGuardOps (disableSoftDelete, disableMultiUserAuthorization, removeMUAProtection, disableSecurityFeatures) so critical destructive operations are always gated by MUA.

PR 6 — Fix security configure-mua safety bug + add security disable-mua

Problem: azurebackup security configure-mua accepted an empty --resource-guard-id, in which case the underlying SDK call silently disabled MUA on the vault instead of failing. This meant a benign-looking "configure" invocation with a typo or missing argument could remove a key security control without any confirmation.

Fix:

  • --resource-guard-id is now required on configure-mua. Missing/empty values return BadRequest with a message that also points users at disable-mua.
  • Added a new azurebackup security disable-mua command that explicitly disables MUA and requires --force. It is marked Destructive.
  • Added mua.action telemetry tag (enable / disable) so both commands can be tracked separately.

Behavior migration:

Before After
configure-mua --resource-guard-id <id> Same — enables MUA
configure-mua (no id) → silently disables MUA Returns BadRequest, directs user to disable-mua
(n/a) disable-mua --force — new explicit disable command

Files changed

  • New commands: Commands/ResourceGuard/{Create,Get,Delete}Command.cs, Commands/Security/SecurityDisableMuaCommand.cs
  • New options: Options/ResourceGuard/*, Options/Security/SecurityDisableMuaOptions.cs
  • New models: Models/ResourceGuardInfo.cs
  • Service: added DisableMultiUserAuthorizationAsync + 3 resource-guard methods to IAzureBackupService / AzureBackupService
  • Telemetry: AzureBackupTelemetryTags.AddMuaActionTag, AddResourceGuardOperationTag
  • Setup: AzureBackupSetup.cs registers the new group and commands
  • Docs: azmcp-commands.md (rewrote MUA section, added Resource Guard section), e2eTestPrompts.md (12 new prompts), consolidated-tools.json (mapped new tools)
  • Changelog entry: shrja-azurebackup-resource-guard-mua-safety.yml
  • cspell: added resourceguard to workspace dictionary

Tests

  • New unit tests for all three resourceguard commands and both security commands
  • New integration test methods SecurityDisableMua_RsvVault_Successfully and SecurityDisableMua_DppVault_Successfully ([LiveTestOnly]) with tolerant error accept set
  • Full test suite: 749 total / 740 passed / 9 skipped ([LiveTestOnly]) / 0 failed

Tool Description Evaluator

I confirm each new tool description scores at least 0.4 on ToolDescriptionEvaluator.

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.

PR 3: New `azurebackup resourceguard` command group (create/get/delete) for Microsoft.DataProtection/resourceGuards, backing Multi-User Authorization.

PR 6: Fix `security configure-mua` silently disabling MUA when --resource-guard-id was omitted. --resource-guard-id is now required. Added new `security disable-mua` command that requires --force to explicitly disable MUA. Added `mua.action` telemetry tag.
@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.

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 extends the Azure Backup toolset by adding a new azurebackup resourceguard command group (create/get/delete) for managing Microsoft.DataProtection/resourceGuards, and fixes a safety issue where security configure-mua could inadvertently disable MUA when --resource-guard-id was omitted by introducing an explicit security disable-mua command gated by --force.

Changes:

  • Added azurebackup resourceguard {create|get|delete} commands plus supporting options/models/service methods.
  • Split MUA disable behavior into a new destructive azurebackup security disable-mua --force command; made --resource-guard-id required for security configure-mua.
  • Updated telemetry tagging, docs (commands + prompts), consolidated tools mapping, changelog entry, and tests.

Reviewed changes

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

Show a summary per file
File Description
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/Security/SecurityDisableMuaCommandTests.cs Adds unit tests for the new explicit disable-mua command and its validation/error handling.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/Security/SecurityConfigureMuaCommandTests.cs Updates tests to ensure configure-mua now only enables MUA and fails when the guard ID is missing/malformed.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/ResourceGuard/ResourceGuardGetCommandTests.cs Adds unit tests for get/list behavior and validation for resourceguard get.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/ResourceGuard/ResourceGuardDeleteCommandTests.cs Adds unit tests for resourceguard delete with --force gating and error mapping.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/ResourceGuard/ResourceGuardCreateCommandTests.cs Adds unit tests for resourceguard create, including excluded-ops and tag parsing validation.
tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/AzureBackupCommandTests.cs Updates live/integration tests to call the new disable-mua tool and includes force.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/IAzureBackupService.cs Extends the service contract with resourceguard CRUD/list operations.
tools/Azure.Mcp.Tools.AzureBackup/src/Services/AzureBackupService.cs Implements resourceguard operations and mandatory exclusion enforcement.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Security/SecurityDisableMuaOptions.cs Introduces --force option for explicit MUA disable.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/Security/SecurityConfigureMuaOptions.cs Updates option description to reflect required guard ID and new disable-mua command.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ResourceGuard/ResourceGuardGetOptions.cs Adds options for get/list Resource Guards.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ResourceGuard/ResourceGuardDeleteOptions.cs Adds options for deleting a Resource Guard with --force.
tools/Azure.Mcp.Tools.AzureBackup/src/Options/ResourceGuard/ResourceGuardCreateOptions.cs Adds options for creating a Resource Guard, including excluded ops and tags.
tools/Azure.Mcp.Tools.AzureBackup/src/Models/ResourceGuardInfo.cs Adds a response model for Resource Guard details.
tools/Azure.Mcp.Tools.AzureBackup/src/Models/AzureBackupTelemetryTags.cs Adds new telemetry tags for MUA action and resourceguard operations.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Security/SecurityDisableMuaCommand.cs Adds the destructive disable-mua command with --force validation and telemetry tagging.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/Security/SecurityConfigureMuaCommand.cs Changes configure-mua to require --resource-guard-id and only enable MUA.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/ResourceGuard/ResourceGuardGetCommand.cs Adds get/list Resource Guard command and telemetry tagging.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/ResourceGuard/ResourceGuardDeleteCommand.cs Adds delete Resource Guard command with --force validation.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/ResourceGuard/ResourceGuardCreateCommand.cs Adds create Resource Guard command including CSV/tags parsing.
tools/Azure.Mcp.Tools.AzureBackup/src/Commands/AzureBackupJsonContext.cs Registers new command result and model types for AOT-safe JSON serialization.
tools/Azure.Mcp.Tools.AzureBackup/src/AzureBackupSetup.cs Registers the new commands and resourceguard subgroup.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Maps new tools into consolidated tool groupings.
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Adds new prompts for resourceguard tools and disable-mua.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Documents the new resourceguard commands and updates MUA command semantics.
servers/Azure.Mcp.Server/changelog-entries/shrja-azurebackup-resource-guard-mua-safety.yml Adds changelog entries for the new commands and safety fix.
.vscode/cspell.json Adds resourceguard to spelling dictionary.

💡 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/docs/azmcp-commands.md Outdated
- ResourceGuardGetCommand: telemetry tag value 'single' -> 'get' (comment 3811668346)
- ResourceGuardCreateCommand: trim tag key/value and reject empty (comment 3811668398)
- ResourceGuardCreateOptions: add disableSecurityFeatures to mandatory ops list in description (comment 3811668438)
- azmcp-commands.md: resourceguard create marked Idempotent (comment 3811668460)
- Added [Theory] test for empty tag key/value validation
- Removed [LiveTestOnly] from SecurityDisableMua_RsvVault_Successfully and SecurityDisableMua_DppVault_Successfully now that they have live recordings.
- Updated assets.json Tag to Azure.Mcp.Tools.AzureBackup.Tests_e1d7bb1d4c (added 2 new SessionRecords for the disable-mua tests).
SecurityConfigureMuaCommand: revert Destructive=true to match the update_azure_backup_settings consolidated group (linking a Resource Guard modifies vault settings). ResourceGuardCreateCommand: set Destructive=true, Idempotent=false to match the create_azure_backup_resources group (consistent with vault/policy/protecteditem create commands). Also update azmcp-commands.md metadata markers to stay in sync. Fixes the DEBUG-only InvalidOperationException in ConsolidatedToolDiscoveryStrategy that was crashing server startup and causing all 13 ConsolidatedModeTests to time out with 'Connection refused'.
Comment thread servers/Azure.Mcp.Server/docs/azmcp-commands.md
Comment thread tools/Azure.Mcp.Tools.AzureBackup/src/Services/AzureBackupService.cs Outdated
…source-guard-mua-safety

# Conflicts:
#	.vscode/cspell.json
#	tools/Azure.Mcp.Tools.AzureBackup/src/Models/AzureBackupTelemetryTags.cs
#	tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/assets.json
…source-guard-mua-safety

# Conflicts:
#	servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json
#	tools/Azure.Mcp.Tools.AzureBackup/src/AzureBackupSetup.cs
#	tools/Azure.Mcp.Tools.AzureBackup/src/Commands/AzureBackupJsonContext.cs
#	tools/Azure.Mcp.Tools.AzureBackup/src/Models/AzureBackupTelemetryTags.cs
#	tools/Azure.Mcp.Tools.AzureBackup/src/Services/AzureBackupService.cs
#	tools/Azure.Mcp.Tools.AzureBackup/src/Services/IAzureBackupService.cs
#	tools/Azure.Mcp.Tools.AzureBackup/tests/Azure.Mcp.Tools.AzureBackup.Tests/assets.json
@shrja-ms
Shraddha Jain (shrja-ms) enabled auto-merge (squash) August 26, 2026 04:37
- Switch assets.json Tag to df01193e95 (from upstream/main via PR microsoft#3345)
  which contains recordings for the new AzureBackupPrivateEndpointCommandTests
  tests introduced after this PR's baseline.
- Regenerate azmcp-commands.md metadata annotations for the resourceguard
  command group, enable-mua and disable-mua commands (out of sync after
  the resource-guard additions).
- Fixes CI test failures:
  * AzureBackupPrivateEndpointCommandTests.PrivateEndpointGet_EmptyVault_ReturnsEmptyList
  * AzureBackupPrivateEndpointCommandTests.PrivateEndpointGet_OnDppVault_ReturnsNotSupported
  * CommandMetadataSyncTests.AzCommandsMetadata_Should_Be_Synchronized
…disable-mua)

The prior tag df01193e95 (from upstream/main via PR microsoft#3345) had recordings for the
new AzureBackupPrivateEndpointCommandTests but was missing recordings for this
PR's SecurityDisableMua_RsvVault_Successfully and SecurityDisableMua_DppVault_Successfully.

Combined both sets by extracting the 2 disable-mua recordings from tag
e1d7bb1d4c and pushing the merged set as new tag fdd4f0baf5.
@shrja-ms
Shraddha Jain (shrja-ms) merged commit 2e9ec55 into microsoft:main Aug 26, 2026
17 of 18 checks passed
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