I'm currently backing up Azure VMs via Azure CLI:
create resource group:
az group create -n backup-resource-group -l uksouth
create recovery services vault:
az backup vault create --resource-group backup-resource-group --name backup --location uksouth
loop VMs to create backup jobs:
az backup protection enable-for-vm --resource-group backup-resource-group --vault-name backup --vm $(az vm show -g servers-resource-group -n {{ loopedoutvm }} --query id | tr -d '"') --policy-name DefaultPolicy
This works fine, but only backs up VMs in the same Azure region. I'd like to adjust this to store the backups in a different region (in addition to the same region the VMs run in). If I run this again with a new resource group and vault created in a different region, Azure returns a message that recovery service vaults can only contain VMs from that location.
Which is strange, because in the Azure portal, it seems I can replicate VM backups to other regions (either via: some VM > disaster recovery > advanced, or via: some recovery services vault > replicate). But I don't know how to achieve this (or something similar) via Azure CLI in order to automate it. There doesn't seem to be anything in Microsoft's documentation for doing this with CLI.
If anyone could point me in the right direction it would be hugely appreciated.