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

Creating Azure Recovery Service Vault - Python SDK - bad request

我正在尝试使用 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创建磁盘备份策略?