Bicep 資源定義
databaseAccounts/sqlDatabases 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
若要建立 Microsoft.DocumentDB/databaseAccounts/sqlDatabases 資源,請將下列 Bicep 新增至範本。
resource symbolicname 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@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/sqlDatabases
AutoscaleSettings
| 名字 |
描述 |
價值 |
| maxThroughput (最大輸送量) |
代表最大輸送量,資源可以相應增加至 。 |
整數 (int) |
CreateUpdateOptionsOrSqlDatabaseGetPropertiesOptions
| 名字 |
描述 |
價值 |
| autoscaleSettings |
指定自動調整設定。 注意:需要輸送量或自動調整設定,但不需要兩者。 |
AutoscaleSettings |
| 輸送量 |
每秒要求單位數。 例如,「輸送量」:10000。 |
整數 (int) |
資源恢復參數
| 名字 |
描述 |
價值 |
| restoreSource (還原源) |
必須起始還原的可還原資料庫帳戶標識碼。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} |
字串 |
| restoreTimestampInUtc |
帳戶必須還原的時間(ISO-8601 格式)。 |
字串 |
| restoreWithTtlDisabled |
指定還原的帳戶是否會在成功還原時停用時間To-Live。 |
布爾 (bool) |
SqlDatabaseCreateUpdatePropertiesOrSqlDatabaseGetProperties
SqlDatabaseResourceOrSqlDatabaseGetPropertiesResource
| 名字 |
描述 |
價值 |
| createMode |
列舉,表示資源建立模式。 |
預設 “恢復” |
| 識別碼 |
Cosmos DB SQL 資料庫的名稱 |
字串 (必要) |
| restoreParameters (還原參數) |
用來指出還原相關信息的參數 |
資源恢復參數 |
使用範例
Azure 快速入門範例
下列 Azure 快速入門範本 包含用於部署此資源類型的 Bicep 範例。
ARM 樣本資源定義
databaseAccounts/sqlDatabases 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
若要建立 Microsoft.DocumentDB/databaseAccounts/sqlDatabases 資源,請將下列 JSON 新增至範本。
{
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases",
"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/sqlDatabases
AutoscaleSettings
| 名字 |
描述 |
價值 |
| maxThroughput (最大輸送量) |
代表最大輸送量,資源可以相應增加至 。 |
整數 (int) |
CreateUpdateOptionsOrSqlDatabaseGetPropertiesOptions
| 名字 |
描述 |
價值 |
| autoscaleSettings |
指定自動調整設定。 注意:需要輸送量或自動調整設定,但不需要兩者。 |
AutoscaleSettings |
| 輸送量 |
每秒要求單位數。 例如,「輸送量」:10000。 |
整數 (int) |
資源恢復參數
| 名字 |
描述 |
價值 |
| restoreSource (還原源) |
必須起始還原的可還原資料庫帳戶標識碼。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} |
字串 |
| restoreTimestampInUtc |
帳戶必須還原的時間(ISO-8601 格式)。 |
字串 |
| restoreWithTtlDisabled |
指定還原的帳戶是否會在成功還原時停用時間To-Live。 |
布爾 (bool) |
SqlDatabaseCreateUpdatePropertiesOrSqlDatabaseGetProperties
SqlDatabaseResourceOrSqlDatabaseGetPropertiesResource
| 名字 |
描述 |
價值 |
| createMode |
列舉,表示資源建立模式。 |
預設 “恢復” |
| 識別碼 |
Cosmos DB SQL 資料庫的名稱 |
字串 (必要) |
| restoreParameters (還原參數) |
用來指出還原相關信息的參數 |
資源恢復參數 |
使用範例
Azure 快速入門範本
下列 Azure 快速入門範本 部署此資源類型。
databaseAccounts/sqlDatabases 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
若要建立 Microsoft.DocumentDB/databaseAccounts/sqlDatabases 資源,請將下列 Terraform 新增至範本。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases@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/sqlDatabases
AutoscaleSettings
| 名字 |
描述 |
價值 |
| maxThroughput (最大輸送量) |
代表最大輸送量,資源可以相應增加至 。 |
整數 (int) |
CreateUpdateOptionsOrSqlDatabaseGetPropertiesOptions
| 名字 |
描述 |
價值 |
| autoscaleSettings |
指定自動調整設定。 注意:需要輸送量或自動調整設定,但不需要兩者。 |
AutoscaleSettings |
| 輸送量 |
每秒要求單位數。 例如,「輸送量」:10000。 |
整數 (int) |
資源恢復參數
| 名字 |
描述 |
價值 |
| restoreSource (還原源) |
必須起始還原的可還原資料庫帳戶標識碼。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} |
字串 |
| restoreTimestampInUtc |
帳戶必須還原的時間(ISO-8601 格式)。 |
字串 |
| restoreWithTtlDisabled |
指定還原的帳戶是否會在成功還原時停用時間To-Live。 |
布爾 (bool) |
SqlDatabaseCreateUpdatePropertiesOrSqlDatabaseGetProperties
SqlDatabaseResourceOrSqlDatabaseGetPropertiesResource
| 名字 |
描述 |
價值 |
| createMode |
列舉,表示資源建立模式。 |
預設 “恢復” |
| 識別碼 |
Cosmos DB SQL 資料庫的名稱 |
字串 (必要) |
| restoreParameters (還原參數) |
用來指出還原相關信息的參數 |
資源恢復參數 |
使用範例
在 Cosmos DB 帳戶內部署 SQL Database 的基本範例。
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 = [
]
consistencyPolicy = {
defaultConsistencyLevel = "BoundedStaleness"
maxIntervalInSeconds = 10
maxStalenessPrefix = 200
}
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" "sqlDatabase" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2021-10-15"
parent_id = azapi_resource.databaseAccount.id
name = var.resource_name
body = {
properties = {
options = {
throughput = 400
}
resource = {
id = var.resource_name
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}