Skip to content

site-recovery | reprotect operation #9437

@JLWProject

Description

@JLWProject

Describe the bug

Hi,

First-time post, sorry if this is the wrong forum to ask this question.

I am looking for some guidance on achieving the following action:

reprotect from a planned failover

I am having trouble trying to get the correct details or potentially the correct command to use to complete this action.

For context, I am using Azure Site Recovery, replicating VMware workloads to Azure using the modern experience. We are making use of express routes, but I doubt that is relevant to the issue.

Workflow progress/process:

  • Unplanned failover (scripted)

  • Commit (Scripted)

  • Reprotect (Scripted) | Azure replicating back to vmware

  • Planned failover (scripted)

  • Commit (Scripted)

  • Reprotect (WIP) | vmware replicating back to Azure

I may be too close to the sun on this, but I seem to be stuck on the provider details. A working example for reprotection I've got (step 3 in my workflow) is the following:


    $providerDetails = @{

          "in-mage-rcm" = @{

              "datastore-name" = $datastore

              "log-storage-account-id" = $storageid

              "reprotect-agent-id" = $applianceid

          }

      } | ConvertTo-Json -Compress -Depth 3

      

      $maxretries = 3

      $retrycount = 0

      $success = $false

      $retrydelayseconds = 35

      

      while (-not $success -and $retrycount -lt $maxretries) {

          try {



              az site-recovery protected-item reprotect `

                  --fabric-name $fabric `

                  --protection-container $container `

                  --replicated-protected-item-name $itemname `

                  --resource-group $resourcegroupgname `

                  --vault-name $vault `

                  --failover-direction RecoveryToPrimary `

                  --provider-details $providerDetails

I've tried looking at examples from Microsoft Learn but have come up short, and I am in the process of looking through the source code to see if I find what I am looking for.

Could be I'm using the wrong command altogether; I just want to clarify.

Thanks!

Related command

** az site-recovery protected-item reprotect --fabric-name $fabric
--protection-container $container --replicated-protected-item-name $itemname
--resource-group $resourcegroupgname --vault-name $vault
--failover-direction RecoveryToPrimary `
--provider-details $providerDetails**

Errors

(BadRequest) An invalid parameter fabricDiscoveryMachineId was passed.
Code: BadRequest
Message: An invalid parameter fabricDiscoveryMachineId was passed.
Exception Details: (InvalidParameter) An invalid parameter fabricDiscoveryMachineId was passed.
Code: InvalidParameter
Message: An invalid parameter fabricDiscoveryMachineId was passed.

(BadRequest) Failed to start operation. Verify input and try operation again.
Code: BadRequest
Message: Failed to start operation. Verify input and try operation again.
Exception Details: (FailedToStartOperation) Failed to start operation. Verify input and try operation again.
Code: FailedToStartOperation
Message: Failed to start operation. Verify input and try operation again.;

Various variations of the above.

Issue script & Debug output

`cli.knack.cli: init debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x000001C6284B8540>, <function OutputProducer.on_global_arguments at 0x000001C62899DA80>, <function CLIQuery.on_global_arguments at 0x000001C6289EF9C0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'site-recovery': ['azext_site_recovery']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: site-recovery 0.757 17 24 C:\Users\jwalker.azure\cliextensions\site-recovery
cli.azure.cli.core: Total (1) 0.757 17 24
cli.azure.cli.core: Loaded 17 groups, 24 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : site-recovery protected-item update
cli.azure.cli.core: Command table: site-recovery protected-item update
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x000001C629A8D260>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\jwalker.azure\commands\2025-11-18.22-31-09.site-recovery_protected-item_update.25880.log'.
az_command_data_logger: command args: site-recovery protected-item update --fabric-name {} --name {} --protection-container {} --resource-group {} --vault-name {} --policy-id {} --provider-details {} --verbose --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x000001C629AD27A0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x000001C629AF8AE0>, <function register_cache_arguments..add_cache_arguments at 0x000001C629AF8CC0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x000001C629AF8D60>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 89, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 271, in setup_operations
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 372, in format_data
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 370, in format_data
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 180, in getitem
azure.cli.core.aaz.exceptions.AAZUnknownFieldError: Model 'AAZObjectArg' has no field named 'reprotect-agent-id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 591, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/parser.py", line 261, in parse_args
File "argparse.py", line 1898, in parse_args
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
File "argparse.py", line 1908, in parse_known_args
File "argparse.py", line 1937, in _parse_known_args2
File "argparse.py", line 2169, in _parse_known_args
File "argparse.py", line 2144, in consume_positionals
File "argparse.py", line 2013, in take_action
File "argparse.py", line 1258, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
File "argparse.py", line 1908, in parse_known_args
File "argparse.py", line 1937, in _parse_known_args2
File "argparse.py", line 2169, in _parse_known_args
File "argparse.py", line 2144, in consume_positionals
File "argparse.py", line 2013, in take_action
File "argparse.py", line 1258, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
File "argparse.py", line 1908, in parse_known_args
File "argparse.py", line 1937, in _parse_known_args2
File "argparse.py", line 2169, in _parse_known_args
File "argparse.py", line 2144, in consume_positionals
File "argparse.py", line 2013, in take_action
File "argparse.py", line 1258, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/parser.py", line 281, in parse_known_args
File "argparse.py", line 1908, in parse_known_args
File "argparse.py", line 1937, in _parse_known_args2
File "argparse.py", line 2188, in _parse_known_args
File "argparse.py", line 2112, in consume_optional
File "argparse.py", line 2013, in take_action
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 95, in call
azure.cli.core.azclierror.InvalidArgumentValueError: Failed to parse '--provider-details' argument: Model 'AAZObjectArg' has no field named 'reprotect-agent-id'`

This changes based on variations I try.

Expected behavior

Not a full example as this is wrapped around several start-jobs in a pipeline:

creating job for: "name" from plan Group0P
creating job for: "name" from plan Group0S
created 2 individual jobs (one per protected item)

elapsed: 00:00:00 | running: 2 | completed: 0[vm job 1] s
[vm job 3] s

elapsed: 00:00:15 | running: 2 | completed: 0
elapsed: 00:00:30 | running: 2 | completed: 0
elapsed: 00:00:45 | running: 2 | completed: 0
elapsed: 00:01:00 | running: 2 | completed: 0
elapsed: 00:01:15 | running: 2 | completed: 0

Environment Summary

"azure-cli": "2.78.0",
"azure-cli-core": "2.78.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"azure-devops": "1.0.2",
"site-recovery": "1.0.0"

ADO runner*

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Service AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions