如何使用Azure cosmosdb SDK创建无服务器的cosmosdb



如何使用Python mgmt SDK azure.mgmt.CosmosDB创建无服务器CosmosDB帐户?

https://learn.microsoft.com/en-us/python/api/azure-mgmt-cosmosdb/azure.mgmt.cosmosdb.models.databaseaccountcreateupdateparameters?view=azure-python预览

我在DatabaseAccountCreateUpdateParameters中看不到任何相关内容。我必须指定哪些属性和值?

这还不普遍,创建无服务器类型的唯一方法是通过Azure门户,在账户类型中选择Servlerss选项

我不了解python,所以我不能保证它会起作用。我所知道的是,无服务器功能可以通过添加";EnableServerless";作为功能的单个项数组。

查看python管理SDK的单元测试,我希望使用这个简单的示例来启用serverless,这个示例说明在创建新帐户时将传递给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()

最新更新