【发布时间】:2020-11-14 02:24:16
【问题描述】:
如何使用 Python mgmt SDK azure.mgmt.cosmosdb 创建无服务器 CosmosDB 帐户?
我在 DatabaseAccountCreateUpdateParameters 中看不到任何相关内容。我必须指定哪些属性和值?
【问题讨论】:
标签: azure azure-cosmosdb
如何使用 Python mgmt SDK azure.mgmt.cosmosdb 创建无服务器 CosmosDB 帐户?
我在 DatabaseAccountCreateUpdateParameters 中看不到任何相关内容。我必须指定哪些属性和值?
【问题讨论】:
标签: azure azure-cosmosdb
这还不是普遍可用的,创建无服务器类型的唯一方法是通过 Azure 门户在帐户类型中选择 Servlerss 选项
【讨论】:
我不知道python,所以我不能保证这会奏效。我所知道的是,可以通过将“EnableServerless”作为单个项目数组添加到功能中来打开无服务器功能。
查看 python 管理 SDK 的单元测试,我希望使用创建新帐户时传递给 create_update_parameters 参数的简单示例来启用无服务器。
BODY = {
"location": AZURE_LOCATION,
"database_account_offer_type": "Standard",
"capabilities": [
{
"EnableServerless"
}
]
"locations": [
{
"location_name": "westus",
"failover_priority": "0"
}
]
}
result = self.mgmt_client.database_accounts.begin_create_or_update(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, create_update_parameters=BODY)
result = result.result()
【讨论】: