Azure / Azure/azure-sdk-for-python
Azure VM Cross-Region Restore from Recovery Services Vault(RA-GRS) Snapshot
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
- **azure-mgmt-recoveryservicesbackup**:
- **7.0.0**:
- **Darwin Kernel Version 25.4.0**:
- **Python 3.14.3**:
**Describe the bug**
Primary Region -- Resource Group and a VM that is BackedUp in Vault Recovery Services configured with RA-GRS, Creating a VM in Secondary Region using the Backup fails with the SDK.
**To Reproduce**
Steps to reproduce the behavior:
1. Ensure Secondary Region(Target Infra -- ResourceGroup and Vnet/Subnet) is in place to Restore a Backup and create a VM.
2. Locate Backup Container and Protected Item in Primary Region(Source Infra - ResourceGroup, VaultName and SourceVMName) -- Container_name and Protected_Item_Name
3. Identify Latest Recovery Point and Identify Disk Metadata if available
4. Trigger cross-region restore job with `RecoveryServicesBackupClient`
```
def trigger_cross_region_restore(
bc: RecoveryServicesBackupClient,
sub_id: str,
vnet_id:str,
vault_rg: str,
vault_name: str,
container: str,
item_name: str,
rp_name: str,
target_rg: str,
target_region: str,
subnet_id: str,
storage_account_id: str,
):
"""
Submit a cross-region RESTORE_DISKS job to the Recovery Services API.
Returns the LRO poller object.
"""
restore_request = IaasVMRestoreRequest(
recovery_type=RecoveryType.RESTORE_DISKS,
target_resource_group_id=(
f"/subscriptions/{sub_id}/resourceGroups/{target_rg}"
),
storage_account_id=storage_account_id,
region=target_region,
virtual_network_id=vnet_id,
subnet_id=subnet_id,
original_storage_account_option=False,
# disk_encryption_set_id=None, # uncomment + set if using CMK
)
log.info(
f"Submitting cross-region restore job ...\n"
f" Vault : {vault_name}\n"
f" Item : {item_name}\n"
f" RP : {rp_name}\n"
f" Target : {target_region} / {target_rg}"
)
return bc.restores.begin_trigger(
vault_name=vault_name,
resource_group_name=vault_rg,
fabric_name="Azure",
container_name=container,
protected_item_name=item_name,
recovery_point_id=rp_name,
parameters=restore_request,
)
```
**Expected behavior**
A VM in Secondary Region(target_region and target_rg) needs to be provisioned using the backup identified by RecoveryPoint.
**Screenshots**
**Additional context**
Additionally Tried Fetching the RecoveryPoint from Secondary Region using the filter:
`filter_string = "use_secondary_region eq 'True'"`
Same issue.
Also tried using REST endpoint for RecoveryPoints with the above filter and multiple compatible api-versions same error
Contributor guide
Assessment
This issue has not been assessed yet.