【问题标题】:How to create a serverless cosmosdb using Azure Cosmosdb SDK?如何使用 Azure Cosmosdb SDK 创建无服务器 cosmosdb?
【发布时间】:2020-11-14 02:24:16
【问题描述】:

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

https://docs.microsoft.com/en-us/python/api/azure-mgmt-cosmosdb/azure.mgmt.cosmosdb.models.databaseaccountcreateupdateparameters?view=azure-python-preview

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

【问题讨论】:

    标签: azure azure-cosmosdb


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      我不知道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()
      

      【讨论】:

        猜你喜欢
        • 2021-11-11
        • 2018-01-08
        • 1970-01-01
        • 1970-01-01
        • 2021-12-06
        • 2018-08-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多