你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
- 最新
- 2025-11-01-预览
- 2025-10-15
- 2025-05-01-预览版
- 2025-04-15
- 2024-12-01-预览版
- 2024-11-15
- 2024-09-01-预览版
- 2024-08-15
- 2024-05-15
- 2024-05-15-预览版
- 2024-02-15-预览版
- 2023-11-15
- 2023-11-15-预览版
- 2023-09-15
- 2023-09-15-预览版
- 2023-04-15
- 2023-03-15
- 2023-03-15-预览版
- 2023-03-01-预览版
- 2022-11-15
- 2022-11-15-预览版
- 2022-08-15
- 2022-08-15-预览版
- 2022-05-15
- 2022-05-15-预览版
- 2022-02-15-预览版
- 2021-11-15-预览版
- 2021-10-15
- 2021-10-15-预览版
- 2021-07-01-预览版
- 2021-06-15
- 2021-05-15
- 2021-04-15
- 2021-04-01-预览版
- 2021-03-15
- 2021-03-01-预览版
- 2021-01-15
- 2020-09-01
- 2020-06-01-预览版
- 2020-04-01
- 2020-03-01
- 2019-12-12
- 2019-08-01
Bicep 资源定义
可以使用目标操作部署 databaseAccounts/sqlDatabases/containers/triggers 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers@2025-05-01-preview' = {
parent: resourceSymbolicName
identity: {
type: 'string'
userAssignedIdentities: {
{customized property}: {}
}
}
location: 'string'
name: 'string'
properties: {
options: {
autoscaleSettings: {
maxThroughput: int
}
throughput: int
}
resource: {
body: 'string'
id: 'string'
triggerOperation: 'string'
triggerType: 'string'
}
}
tags: {
{customized property}: 'string'
}
}
属性值
Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 标识 | 资源的标识。 | ManagedServiceIdentity |
| 位置 | 资源所属的资源组的位置。 | 字符串 |
| 姓名 | 资源名称 | string (必需) |
| 父级 | 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。 有关详细信息,请参阅 父资源外部的子资源。 |
类型资源的符号名称:databaseAccounts/sqlDatabases/containers |
| 属性 | 用于创建和更新 Azure Cosmos DB 触发器的属性。 | SqlTriggerCreateUpdatePropertiesOrSqlTriggerGetProperties(必需) |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
AutoscaleSettings
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| maxThroughput (最大吞吐量) | 表示最大吞吐量,资源可以纵向扩展。 | 整数 (int) |
Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties
| 名称 | DESCRIPTION | 价值 |
|---|
CreateUpdateOptions
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| autoscaleSettings | 指定自动缩放设置。 注意:需要吞吐量或自动缩放设置,但不需要两者。 | AutoscaleSettings |
| 吞吐量 | 每秒请求单位数。 例如,“throughput”:10000。 | 整数 (int) |
ManagedServiceIdentity
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 类型 | 用于资源的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从服务中删除任何标识。 | “None” “SystemAssigned” “SystemAssigned,UserAssigned” “UserAssigned” |
| 用户分配的标识 | 与资源关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 | ManagedServiceIdentityUserAssignedIdentities |
ManagedServiceIdentityUserAssignedIdentities
| 名称 | DESCRIPTION | 价值 |
|---|
SqlTriggerCreateUpdatePropertiesOrSqlTriggerGetProperties
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 选项 | 要为请求应用的选项的键值对。 这对应于随请求一起发送的标头。 | CreateUpdateOptions |
| 资源 | 触发器的标准 JSON 格式 | SqlTriggerResourceOrSqlTriggerGetPropertiesResource(必需) |
SqlTriggerResourceOrSqlTriggerGetPropertiesResource
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 身体 | 触发器的正文 | 字符串 |
| 身份证 | Cosmos DB SQL 触发器的名称 | string (必需) |
| triggerOperation | 触发器与的操作相关联 | “All” “Create” “Delete” “Replace” “Update” |
| triggerType | 触发器的类型 | “Post” “Pre” |
标记
| 名称 | DESCRIPTION | 价值 |
|---|
用法示例
Azure 快速入门示例
以下 Azure 快速入门模板 包含用于部署此资源类型的 Bicep 示例。
| Bicep 文件 | DESCRIPTION |
|---|---|
| 创建 Azure Cosmos DB Core (SQL) API 存储过程 | 此模板创建一个用于 Core (SQL) API 的 Azure Cosmos DB 帐户,以及一个包含存储过程、触发器和用户定义的函数的容器。 |
ARM 模板资源定义
可以使用目标操作部署 databaseAccounts/sqlDatabases/containers/triggers 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers",
"apiVersion": "2025-05-01-preview",
"name": "string",
"identity": {
"type": "string",
"userAssignedIdentities": {
"{customized property}": {
}
}
},
"location": "string",
"properties": {
"options": {
"autoscaleSettings": {
"maxThroughput": "int"
},
"throughput": "int"
},
"resource": {
"body": "string",
"id": "string",
"triggerOperation": "string",
"triggerType": "string"
}
},
"tags": {
"{customized property}": "string"
}
}
属性值
Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| apiVersion | API 版本 | “2025-05-01-预览” |
| 标识 | 资源的标识。 | ManagedServiceIdentity |
| 位置 | 资源所属的资源组的位置。 | 字符串 |
| 姓名 | 资源名称 | string (必需) |
| 属性 | 用于创建和更新 Azure Cosmos DB 触发器的属性。 | SqlTriggerCreateUpdatePropertiesOrSqlTriggerGetProperties(必需) |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
| 类型 | 资源类型 | “Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers” |
AutoscaleSettings
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| maxThroughput (最大吞吐量) | 表示最大吞吐量,资源可以纵向扩展。 | 整数 (int) |
Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties
| 名称 | DESCRIPTION | 价值 |
|---|
CreateUpdateOptions
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| autoscaleSettings | 指定自动缩放设置。 注意:需要吞吐量或自动缩放设置,但不需要两者。 | AutoscaleSettings |
| 吞吐量 | 每秒请求单位数。 例如,“throughput”:10000。 | 整数 (int) |
ManagedServiceIdentity
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 类型 | 用于资源的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从服务中删除任何标识。 | “None” “SystemAssigned” “SystemAssigned,UserAssigned” “UserAssigned” |
| 用户分配的标识 | 与资源关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 | ManagedServiceIdentityUserAssignedIdentities |
ManagedServiceIdentityUserAssignedIdentities
| 名称 | DESCRIPTION | 价值 |
|---|
SqlTriggerCreateUpdatePropertiesOrSqlTriggerGetProperties
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 选项 | 要为请求应用的选项的键值对。 这对应于随请求一起发送的标头。 | CreateUpdateOptions |
| 资源 | 触发器的标准 JSON 格式 | SqlTriggerResourceOrSqlTriggerGetPropertiesResource(必需) |
SqlTriggerResourceOrSqlTriggerGetPropertiesResource
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 身体 | 触发器的正文 | 字符串 |
| 身份证 | Cosmos DB SQL 触发器的名称 | string (必需) |
| triggerOperation | 触发器与的操作相关联 | “All” “Create” “Delete” “Replace” “Update” |
| triggerType | 触发器的类型 | “Post” “Pre” |
标记
| 名称 | DESCRIPTION | 价值 |
|---|
用法示例
Azure 快速入门模板
以下 Azure 快速入门模板 部署此资源类型。
| 模板 | DESCRIPTION |
|---|---|
|
创建 Azure Cosmos DB Core (SQL) API 存储过程 |
此模板创建一个用于 Core (SQL) API 的 Azure Cosmos DB 帐户,以及一个包含存储过程、触发器和用户定义的函数的容器。 |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署 databaseAccounts/sqlDatabases/containers/triggers 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers@2025-05-01-preview"
name = "string"
parent_id = "string"
identity {
type = "string"
identity_ids = [
"string"
]
}
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
options = {
autoscaleSettings = {
maxThroughput = int
}
throughput = int
}
resource = {
body = "string"
id = "string"
triggerOperation = "string"
triggerType = "string"
}
}
}
}
属性值
Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 标识 | 资源的标识。 | ManagedServiceIdentity |
| 位置 | 资源所属的资源组的位置。 | 字符串 |
| 姓名 | 资源名称 | string (必需) |
| parent_id | 此资源的父资源的 ID。 | 类型资源的 ID:databaseAccounts/sqlDatabases/containers |
| 属性 | 用于创建和更新 Azure Cosmos DB 触发器的属性。 | SqlTriggerCreateUpdatePropertiesOrSqlTriggerGetProperties(必需) |
| 标签 | 资源标记 | 标记名称和值的字典。 |
| 类型 | 资源类型 | “Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers@2025-05-01-preview” |
AutoscaleSettings
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| maxThroughput (最大吞吐量) | 表示最大吞吐量,资源可以纵向扩展。 | 整数 (int) |
Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties
| 名称 | DESCRIPTION | 价值 |
|---|
CreateUpdateOptions
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| autoscaleSettings | 指定自动缩放设置。 注意:需要吞吐量或自动缩放设置,但不需要两者。 | AutoscaleSettings |
| 吞吐量 | 每秒请求单位数。 例如,“throughput”:10000。 | 整数 (int) |
ManagedServiceIdentity
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 类型 | 用于资源的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从服务中删除任何标识。 | “None” “SystemAssigned” “SystemAssigned,UserAssigned” “UserAssigned” |
| 用户分配的标识 | 与资源关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 | ManagedServiceIdentityUserAssignedIdentities |
ManagedServiceIdentityUserAssignedIdentities
| 名称 | DESCRIPTION | 价值 |
|---|
SqlTriggerCreateUpdatePropertiesOrSqlTriggerGetProperties
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 选项 | 要为请求应用的选项的键值对。 这对应于随请求一起发送的标头。 | CreateUpdateOptions |
| 资源 | 触发器的标准 JSON 格式 | SqlTriggerResourceOrSqlTriggerGetPropertiesResource(必需) |
SqlTriggerResourceOrSqlTriggerGetPropertiesResource
| 名称 | DESCRIPTION | 价值 |
|---|---|---|
| 身体 | 触发器的正文 | 字符串 |
| 身份证 | Cosmos DB SQL 触发器的名称 | string (必需) |
| triggerOperation | 触发器与的操作相关联 | “All” “Create” “Delete” “Replace” “Update” |
| triggerType | 触发器的类型 | “Post” “Pre” |
标记
| 名称 | DESCRIPTION | 价值 |
|---|
用法示例
Terraform 示例
部署 SQL Trigger 的基本示例。
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 = "Session"
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" "sqlDatabase" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases@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 = ["*"]
}
resource "azapi_resource" "container" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2023-04-15"
parent_id = azapi_resource.sqlDatabase.id
name = var.resource_name
body = {
properties = {
options = {
}
resource = {
id = var.resource_name
partitionKey = {
kind = "Hash"
paths = [
"/definition/id",
]
}
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "trigger" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers@2021-10-15"
parent_id = azapi_resource.container.id
name = var.resource_name
body = {
properties = {
options = {
}
resource = {
body = "function trigger(){}"
id = var.resource_name
triggerOperation = "All"
triggerType = "Pre"
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}