如何使用 ARM 模板创建 CosmosDB SQL API 无服务器帐户?

How to create CosmosDB SQL API serverless account with ARM template?

我正在尝试使用 Cosmosdb 创建一个无服务器帐户 sql api 但我没有找到给定的任何示例 here

我已尝试使用以下 ARM 模板,但它没有创建无服务器帐户

  "resources" : [
        {
            "type": "Microsoft.DocumentDB/databaseAccounts",
            "apiVersion": "2020-04-01",
            "kind": "Serverless",
            "name": "[parameters('accountName')]",
            "location": "[parameters('location')]",
            "properties": {
              "enableFreeTier": false,            
              "databaseAccountOfferType": "Standard",
              "consistencyPolicy": {
                "defaultConsistencyLevel": "Session"
              },
              "locations": [
                {
                  "locationName": "[parameters('location')]"
                }
              ]
            }
          },
          {
            "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases",
            "apiVersion": "2020-04-01",
            "name": "[format('{0}/{1}', parameters('accountName'), parameters('databaseName'))]",
            "properties": {
              "resource": {
                "id": "[parameters('databaseName')]"
              },
              "options": {}
            },
            "dependsOn": [
              "[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('accountName'))]"
            ]
          }

    ]

抛出错误“ "message": "无服务器资源种类 unknown\r\nActivityId: 0c86f162-3386-49e1-b354-57ba309bb44f, Microsoft.Azure.Documents.Common/2.14.0""

错误有效,以下是 databaseAccount kind

可用的可能值
  • 'GlobalDocumentDB'
  • 'MongoDB'
  • 'Parse'

要创建无服务器帐户,您需要在属性下传递以下功能参数

 "properties": {
          "enableFreeTier": false,
          "capabilities": [
            {
              "name": "EnableServerless"
            }
          ],
          "databaseAccountOfferType": "Standard",
          "consistencyPolicy": {
            "defaultConsistencyLevel": "Session"
          },
          "locations": [
            {
              "locationName": "[parameters('location')]"
            }
          ]
        }