Microsoft.DocumentDB 資料庫Accounts/tables 2024-11-15

Bicep 資源定義

databaseAccounts/tables 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

使用範例

Bicep 範例

在 Cosmos DB 帳戶內部署資料表的基本範例。

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource databaseAccount 'Microsoft.DocumentDB/databaseAccounts@2021-10-15' = {
  name: resourceName
  location: location
  kind: 'GlobalDocumentDB'
  properties: {
    capabilities: [
      {
        name: 'EnableTable'
      }
    ]
    consistencyPolicy: {
      defaultConsistencyLevel: 'Strong'
      maxIntervalInSeconds: 5
      maxStalenessPrefix: 100
    }
    databaseAccountOfferType: 'Standard'
    defaultIdentity: 'FirstPartyIdentity'
    disableKeyBasedMetadataWriteAccess: false
    disableLocalAuth: false
    enableAnalyticalStorage: false
    enableAutomaticFailover: false
    enableFreeTier: false
    enableMultipleWriteLocations: false
    ipRules: []
    isVirtualNetworkFilterEnabled: false
    locations: [
      {
        failoverPriority: 0
        isZoneRedundant: false
        locationName: 'West Europe'
      }
    ]
    networkAclBypass: 'None'
    networkAclBypassResourceIds: []
    publicNetworkAccess: 'Enabled'
    virtualNetworkRules: []
  }
}

resource table 'Microsoft.DocumentDB/databaseAccounts/tables@2021-10-15' = {
  name: resourceName
  parent: databaseAccount
  properties: {
    options: {}
    resource: {
      id: resourceName
    }
  }
}

Azure 快速入門範例

下列 Azure 快速入門範本 包含用於部署此資源類型的 Bicep 範例。

Bicep 檔案 描述
為數據表 API 建立 Azure Cosmos 帳戶 此範本會在兩個區域中建立適用於數據表 API 的 Azure Cosmos DB 帳戶,以及具有布建輸送量的單一數據表。
使用自動調整 建立數據表 API 的 Azure Cosmos 帳戶 此範本會在兩個區域中建立適用於數據表 API 的 Azure Cosmos DB 帳戶,以及具有自動調整輸送量的單一數據表。

資源格式

若要建立 Microsoft.DocumentDB/databaseAccounts/tables 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.DocumentDB/databaseAccounts/tables@2024-11-15' = {
  parent: resourceSymbolicName
  location: 'string'
  name: 'string'
  properties: {
    options: {
      autoscaleSettings: {
        maxThroughput: int
      }
      throughput: int
    }
    resource: {
      createMode: 'string'
      id: 'string'
      restoreParameters: {
        restoreSource: 'string'
        restoreTimestampInUtc: 'string'
        restoreWithTtlDisabled: bool
      }
    }
  }
  tags: {
    {customized property}: 'string'
  }
}

屬性值

Microsoft.DocumentDB/databaseAccounts/tables

名字 描述 價值
位置 資源所屬資源群組的位置。 字串
名字 資源名稱 字串 (必要)
父代 在 Bicep 中,您可以指定子資源的父資源。 只有在父資源外部宣告子資源時,才需要新增這個屬性。

如需詳細資訊,請參閱 父資源外部的子資源。
類型資源的符號名稱:databaseAccounts
性能 建立及更新 Azure Cosmos DB 資料表的屬性。 TableCreateUpdatePropertiesOrTableGetProperties (必要)
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤

AutoscaleSettings

名字 描述 價值
maxThroughput (最大輸送量) 代表最大輸送量,資源可以相應增加至 。 整數 (int)

CreateUpdateOptionsOrTableGetPropertiesOptions

名字 描述 價值
autoscaleSettings 指定自動調整設定。 注意:需要輸送量或自動調整設定,但不需要兩者。 AutoscaleSettings
輸送量 每秒要求單位數。 例如,「輸送量」:10000。 整數 (int)

資源恢復參數

名字 描述 價值
restoreSource (還原源) 必須起始還原的可還原資料庫帳戶標識碼。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} 字串
restoreTimestampInUtc 帳戶必須還原的時間(ISO-8601 格式)。 字串
restoreWithTtlDisabled 指定還原的帳戶是否會在成功還原時停用時間To-Live。 布爾 (bool)

TableCreateUpdatePropertiesOrTableGetProperties

名字 描述 價值
選項 要套用要求之選項的索引鍵/值組。 這會對應至隨要求傳送的標頭。 CreateUpdateOptionsOrTableGetPropertiesOptions
資源 數據表的標準 JSON 格式 TableResourceOrTableGetPropertiesResource (必要)

TableResourceOrTableGetPropertiesResource

名字 描述 價值
createMode 列舉,表示資源建立模式。 預設
“恢復”
識別碼 Cosmos DB 資料表的名稱 字串 (必要)
restoreParameters (還原參數) 用來指出還原相關信息的參數 資源恢復參數

標籤

名字 描述 價值

ARM 樣本資源定義

databaseAccounts/tables 資源類型可以使用目標作業來部署:

使用範例

Azure 快速入門範本

下列 Azure 快速入門範本 部署此資源類型。

範本 描述
為數據表 API 建立 Azure Cosmos 帳戶

部署至 Azure
此範本會在兩個區域中建立適用於數據表 API 的 Azure Cosmos DB 帳戶,以及具有布建輸送量的單一數據表。
使用自動調整 建立數據表 API 的 Azure Cosmos 帳戶

部署至 Azure
此範本會在兩個區域中建立適用於數據表 API 的 Azure Cosmos DB 帳戶,以及具有自動調整輸送量的單一數據表。

資源格式

若要建立 Microsoft.DocumentDB/databaseAccounts/tables 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.DocumentDB/databaseAccounts/tables",
  "apiVersion": "2024-11-15",
  "name": "string",
  "location": "string",
  "properties": {
    "options": {
      "autoscaleSettings": {
        "maxThroughput": "int"
      },
      "throughput": "int"
    },
    "resource": {
      "createMode": "string",
      "id": "string",
      "restoreParameters": {
        "restoreSource": "string",
        "restoreTimestampInUtc": "string",
        "restoreWithTtlDisabled": "bool"
      }
    }
  },
  "tags": {
    "{customized property}": "string"
  }
}

屬性值

Microsoft.DocumentDB/databaseAccounts/tables

名字 描述 價值
apiVersion API 版本 '2024-11-15'
位置 資源所屬資源群組的位置。 字串
名字 資源名稱 字串 (必要)
性能 建立及更新 Azure Cosmos DB 資料表的屬性。 TableCreateUpdatePropertiesOrTableGetProperties (必要)
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤
型別 資源類型 “Microsoft.DocumentDB/databaseAccounts/tables”

AutoscaleSettings

名字 描述 價值
maxThroughput (最大輸送量) 代表最大輸送量,資源可以相應增加至 。 整數 (int)

CreateUpdateOptionsOrTableGetPropertiesOptions

名字 描述 價值
autoscaleSettings 指定自動調整設定。 注意:需要輸送量或自動調整設定,但不需要兩者。 AutoscaleSettings
輸送量 每秒要求單位數。 例如,「輸送量」:10000。 整數 (int)

資源恢復參數

名字 描述 價值
restoreSource (還原源) 必須起始還原的可還原資料庫帳戶標識碼。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} 字串
restoreTimestampInUtc 帳戶必須還原的時間(ISO-8601 格式)。 字串
restoreWithTtlDisabled 指定還原的帳戶是否會在成功還原時停用時間To-Live。 布爾 (bool)

TableCreateUpdatePropertiesOrTableGetProperties

名字 描述 價值
選項 要套用要求之選項的索引鍵/值組。 這會對應至隨要求傳送的標頭。 CreateUpdateOptionsOrTableGetPropertiesOptions
資源 數據表的標準 JSON 格式 TableResourceOrTableGetPropertiesResource (必要)

TableResourceOrTableGetPropertiesResource

名字 描述 價值
createMode 列舉,表示資源建立模式。 預設
“恢復”
識別碼 Cosmos DB 資料表的名稱 字串 (必要)
restoreParameters (還原參數) 用來指出還原相關信息的參數 資源恢復參數

標籤

名字 描述 價值

Terraform (AzAPI 提供者) 資源定義

databaseAccounts/tables 資源類型可以使用目標作業來部署:

  • 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

在 Cosmos DB 帳戶內部署資料表的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "databaseAccount" {
  type      = "Microsoft.DocumentDB/databaseAccounts@2021-10-15"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    kind = "GlobalDocumentDB"
    properties = {
      capabilities = [
        {
          name = "EnableTable"
        },
      ]
      consistencyPolicy = {
        defaultConsistencyLevel = "Strong"
        maxIntervalInSeconds    = 5
        maxStalenessPrefix      = 100
      }
      databaseAccountOfferType           = "Standard"
      defaultIdentity                    = "FirstPartyIdentity"
      disableKeyBasedMetadataWriteAccess = false
      disableLocalAuth                   = false
      enableAnalyticalStorage            = false
      enableAutomaticFailover            = false
      enableFreeTier                     = false
      enableMultipleWriteLocations       = false
      ipRules = [
      ]
      isVirtualNetworkFilterEnabled = false
      locations = [
        {
          failoverPriority = 0
          isZoneRedundant  = false
          locationName     = "West Europe"
        },
      ]
      networkAclBypass = "None"
      networkAclBypassResourceIds = [
      ]
      publicNetworkAccess = "Enabled"
      virtualNetworkRules = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "table" {
  type      = "Microsoft.DocumentDB/databaseAccounts/tables@2021-10-15"
  parent_id = azapi_resource.databaseAccount.id
  name      = var.resource_name
  body = {
    properties = {
      options = {
      }
      resource = {
        id = var.resource_name
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

資源格式

若要建立 Microsoft.DocumentDB/databaseAccounts/tables 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DocumentDB/databaseAccounts/tables@2024-11-15"
  name = "string"
  parent_id = "string"
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      options = {
        autoscaleSettings = {
          maxThroughput = int
        }
        throughput = int
      }
      resource = {
        createMode = "string"
        id = "string"
        restoreParameters = {
          restoreSource = "string"
          restoreTimestampInUtc = "string"
          restoreWithTtlDisabled = bool
        }
      }
    }
  }
}

屬性值

Microsoft.DocumentDB/databaseAccounts/tables

名字 描述 價值
位置 資源所屬資源群組的位置。 字串
名字 資源名稱 字串 (必要)
父項識別碼 此資源為父系之資源的標識碼。 類型資源的標識碼:databaseAccounts
性能 建立及更新 Azure Cosmos DB 資料表的屬性。 TableCreateUpdatePropertiesOrTableGetProperties (必要)
標籤 資源標籤 標記名稱和值的字典。
型別 資源類型 “Microsoft.DocumentDB/databaseAccounts/tables@2024-11-15”

AutoscaleSettings

名字 描述 價值
maxThroughput (最大輸送量) 代表最大輸送量,資源可以相應增加至 。 整數 (int)

CreateUpdateOptionsOrTableGetPropertiesOptions

名字 描述 價值
autoscaleSettings 指定自動調整設定。 注意:需要輸送量或自動調整設定,但不需要兩者。 AutoscaleSettings
輸送量 每秒要求單位數。 例如,「輸送量」:10000。 整數 (int)

資源恢復參數

名字 描述 價值
restoreSource (還原源) 必須起始還原的可還原資料庫帳戶標識碼。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} 字串
restoreTimestampInUtc 帳戶必須還原的時間(ISO-8601 格式)。 字串
restoreWithTtlDisabled 指定還原的帳戶是否會在成功還原時停用時間To-Live。 布爾 (bool)

TableCreateUpdatePropertiesOrTableGetProperties

名字 描述 價值
選項 要套用要求之選項的索引鍵/值組。 這會對應至隨要求傳送的標頭。 CreateUpdateOptionsOrTableGetPropertiesOptions
資源 數據表的標準 JSON 格式 TableResourceOrTableGetPropertiesResource (必要)

TableResourceOrTableGetPropertiesResource

名字 描述 價值
createMode 列舉,表示資源建立模式。 預設
“恢復”
識別碼 Cosmos DB 資料表的名稱 字串 (必要)
restoreParameters (還原參數) 用來指出還原相關信息的參數 資源恢復參數

標籤

名字 描述 價值