我可以部署VM,但当我尝试使用备份保管库(位于不同的资源组中(时,我会收到以下错误
"未找到资源组'rg-hub centralus'下的资源'Microsoft.RecoveryServices/svault/rsv-hub central us'。">
在Json模板中,这里是代码
parameters:{
"recoveryServiceVaultName" :{
"type" :"string",
"metadata": {
"description": "Existing Recovery Service Vault Name in the Subscription"
}
},
}
"variables": {
"backupFabric": "Azure",
"backupPolicyName": "RA-standard-daily-11pm-centralus",
"v2VmType": "Microsoft.Compute/virtualMachines",
"v2VmContainer": "iaasvmcontainer;iaasvmcontainerv2;",
"v2Vm": "vm;iaasvmcontainerv2;"
},
"resources": [
{
"name": "[concat(parameters('recoveryServiceVaultName'), '/', variables('backupFabric'), '/', variables('v2VmContainer'), concat(resourcegroup().name,';',parameters('vmName')), '/', variables('v2Vm'), concat(resourcegroup().name,';',parameters('vmName')))]",
"apiVersion": "2016-06-01",
"location": "[parameters('location')]",
"type": "Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems",
"properties": {
"protectedItemType": "[variables('v2VmType')]",
"policyId": "[resourceId(parameters('vaultResourceGroup'),'Microsoft.RecoveryServices/vaults/backupPolicies',parameters('recoveryServiceVaultName'),variables('backupPolicyName'))]",
"sourceResourceId": "[resourceId(resourcegroup().name,'Microsoft.Compute/virtualMachines',parameters('vmName'))]"
}
}
]
在Powershell中,我调用json文件
$recoveryServiceVault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "rg-hubb-recoveryservice-centralus"
$recoveryServiceVaultName = $recoveryServiceVault.Name
# Assemble template parameters
$templateParameters = @{}
$templateParameters.Add("recoveryServiceVaultName", $recoveryServiceVaultName)
New-AzureRmResourceGroup -ResourceGroupName $resourceGroupName -Location $location -Force
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile "azuredeploy.json" -TemplateParameterObject $templateParameters
resourceGroup((.name在"protectionContainer"one_answers"protectionItem"中-是VM的资源组还是RSV
在我看来,这是VM的资源组。查看protectedItemId的模板属性。所以我认为protectedItem就是您想要备份的VM。还有一个关于备份的示例模板,请参阅恢复服务备份vm。使用确切资源类型命名的变量。