正在创建Azure恢复服务保管库-Python SDK-错误请求



我正在尝试使用Python SDK在Azure中创建恢复服务保险库。包版本:azure mgmt recoveryservices==2.0.0

代码片段

client=RecoveryServicesClient(client_secret_credential, subscription_id)
client.vaults.begin_create_or_update(
resource_group_name="my-custom-rg",
vault_name="name_of_the_vault",
vault={
"location": "centralus", 
"sku": {
"name": "Standard",
},
"identity": {
"type": "SystemAssigned",
}
}
)

我得到以下错误:

File "/<my-computer-path>/azure/lib/python3.8/site-packages/azure/mgmt/recoveryservices/operations/_vaults_operations.py", line 293, in _create_or_update_initial
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'

我做错了什么?我怎么能做得更多;错误调查";?

谢谢Robert。将您的建议作为答案发布,以帮助其他社区成员。

此错误azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'是由缺少backup_policy_resource属性引起的。

policy_resource = BaseBackupPolicyResource(properties=backup_policy)
poller = client.backup_policies.create_or_update(
vault_name="my-vault-name",
resource_group_name="my-resource-group",
backup_policy_name="my-daily-backup",
parameters=policy_resource
)

您可以参考如何使用azure python SDK创建磁盘备份策略?

相关内容

  • 没有找到相关文章

最新更新