通过


你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Microsoft。SQL 服务器/数据库/透明数据加密

Bicep资源定义

可以使用目标操作部署 servers/databases/transparentDataEncryption 资源类型:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

去创造一个Microsoft。Sql/servers/databases/transparentDataEncryption 资源,将以下 Bicep 添加到你的模板中。

resource symbolicname 'Microsoft.Sql/servers/databases/transparentDataEncryption@2025-02-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    scanState: 'string'
    state: 'string'
  }
}

属性值

Microsoft。Sql/servers/databases/transparentDataEncryption

Name Description Value
name 资源名称 “current”(必需)
父级 在 Bicep 中,你可以指定子资源的父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。

有关详细信息,请参阅 父资源外部的子资源
类型资源的符号名称:服务器/数据库
properties 资源属性。 TransparentDataEncryptionProperties

TransparentDataEncryptionProperties

Name Description Value
扫描状态 指定透明数据加密的加密扫描状态。 “流产”
'Completed'
'None'
“简历”
'Running'
“暂停”
状态 指定透明数据加密的状态。 'Disabled'
“Enabled”(必需)

用法示例

Bicep 样本

部署 SQL Server 数据库的基本示例:透明数据加密。

param resourceName string = 'acctest0001'
param location string = 'westeurope'
@secure()
@description('The administrator login password for the SQL server')
param administratorLoginPassword string

resource server 'Microsoft.Sql/servers@2021-02-01-preview' = {
  name: resourceName
  location: location
  properties: {
    administratorLogin: 'mradministrator'
    administratorLoginPassword: null
    minimalTlsVersion: '1.2'
    publicNetworkAccess: 'Enabled'
    restrictOutboundNetworkAccess: 'Disabled'
    version: '12.0'
  }
}

resource database 'Microsoft.Sql/servers/databases@2021-02-01-preview' = {
  parent: server
  name: resourceName
  location: location
  properties: {
    autoPauseDelay: 0
    createMode: 'Default'
    elasticPoolId: ''
    highAvailabilityReplicaCount: 0
    isLedgerOn: false
    licenseType: 'LicenseIncluded'
    maintenanceConfigurationId: resourceId('Microsoft.Maintenance/publicMaintenanceConfigurations', 'SQL_Default')
    minCapacity: 0
    readScale: 'Disabled'
    requestedBackupStorageRedundancy: 'Geo'
    zoneRedundant: false
  }
}

resource transparentDataEncryption 'Microsoft.Sql/servers/databases/transparentDataEncryption@2014-04-01' = {
  parent: database
  name: 'current'
  properties: {
    status: 'Enabled'
  }
}

Azure 快速入门示例

以下Azure快速启动模板包含部署该资源类型的Bicep示例。

Bicep 文件 Description
专用SQL池,采用透明加密 创建一个SQL Server和一个专用SQL池(前称SQL DW),并采用透明数据加密。

ARM 模板资源定义

可以使用目标操作部署 servers/databases/transparentDataEncryption 资源类型:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

去创造一个Microsoft。Sql/servers/databases/transparentDataEncryption 资源,在模板中添加以下 JSON 代码。

{
  "type": "Microsoft.Sql/servers/databases/transparentDataEncryption",
  "apiVersion": "2025-02-01-preview",
  "name": "string",
  "properties": {
    "scanState": "string",
    "state": "string"
  }
}

属性值

Microsoft。Sql/servers/databases/transparentDataEncryption

Name Description Value
apiVersion API 版本 “2025-02-01-预览”
name 资源名称 “current”(必需)
properties 资源属性。 TransparentDataEncryptionProperties
类型 资源类型 “Microsoft。Sql/servers/databases/transparentDataEncryption'

TransparentDataEncryptionProperties

Name Description Value
扫描状态 指定透明数据加密的加密扫描状态。 “流产”
'Completed'
'None'
“简历”
'Running'
“暂停”
状态 指定透明数据加密的状态。 'Disabled'
“Enabled”(必需)

用法示例

Azure Quickstart Templates

以下Azure快速启动模板部署了这种资源类型。

Template Description
专用SQL池,采用透明加密

部署到Azure
创建一个SQL Server和一个专用SQL池(前称SQL DW),并采用透明数据加密。

Terraform (AzAPI 提供程序)资源定义

可以使用目标操作部署 servers/databases/transparentDataEncryption 资源类型:

  • 资源组

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

去创造一个Microsoft。Sql/servers/databases/transparentDataEncryption 资源,将以下 Terraform 添加到你的模板中。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Sql/servers/databases/transparentDataEncryption@2025-02-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      scanState = "string"
      state = "string"
    }
  }
}

属性值

Microsoft。Sql/servers/databases/transparentDataEncryption

Name Description Value
name 资源名称 “current”(必需)
parent_id 此资源的父资源的 ID。 类型资源的 ID:服务器/数据库
properties 资源属性。 TransparentDataEncryptionProperties
类型 资源类型 “Microsoft。Sql/servers/databases/transparentDataEncryption@2025-02-01-preview”

TransparentDataEncryptionProperties

Name Description Value
扫描状态 指定透明数据加密的加密扫描状态。 “流产”
'Completed'
'None'
“简历”
'Running'
“暂停”
状态 指定透明数据加密的状态。 'Disabled'
“Enabled”(必需)

用法示例

Terraform 示例

部署 SQL Server 数据库的基本示例:透明数据加密。

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

provider "azurerm" {
  features {
  }
}

provider "azapi" {
  skip_provider_registration = false
}

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

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

variable "administrator_login_password" {
  type        = string
  description = "The administrator login password for the SQL server"
  sensitive   = true
}

data "azurerm_client_config" "current" {
}

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

resource "azapi_resource" "server" {
  type      = "Microsoft.Sql/servers@2021-02-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      administratorLogin            = "mradministrator"
      administratorLoginPassword    = var.administrator_login_password
      minimalTlsVersion             = "1.2"
      publicNetworkAccess           = "Enabled"
      restrictOutboundNetworkAccess = "Disabled"
      version                       = "12.0"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

data "azapi_resource_id" "publicMaintenanceConfiguration" {
  type      = "Microsoft.Maintenance/publicMaintenanceConfigurations@2023-04-01"
  parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
  name      = "SQL_Default"
}

resource "azapi_resource" "database" {
  type      = "Microsoft.Sql/servers/databases@2021-02-01-preview"
  parent_id = azapi_resource.server.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      autoPauseDelay                   = 0
      createMode                       = "Default"
      elasticPoolId                    = ""
      highAvailabilityReplicaCount     = 0
      isLedgerOn                       = false
      licenseType                      = "LicenseIncluded"
      maintenanceConfigurationId       = data.azapi_resource_id.publicMaintenanceConfiguration.id
      minCapacity                      = 0
      readScale                        = "Disabled"
      requestedBackupStorageRedundancy = "Geo"
      zoneRedundant                    = false
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_update_resource" "transparentDataEncryption" {
  type      = "Microsoft.Sql/servers/databases/transparentDataEncryption@2014-04-01"
  parent_id = azapi_resource.database.id
  name      = "current"
  body = {
    properties = {
      status = "Enabled"
    }
  }
  response_export_values = ["*"]
}