Microsoft。Sql instancePools 2025-01-01

Bicep 資源定義

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

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

資源格式

創造一個 Microsoft。Sql/instancePools 資源,請將以下 Bicep 加入你的範本。

resource symbolicname 'Microsoft.Sql/instancePools@2025-01-01' = {
  location: 'string'
  name: 'string'
  properties: {
    licenseType: 'string'
    maintenanceConfigurationId: 'string'
    subnetId: 'string'
    vCores: int
  }
  sku: {
    capacity: int
    family: 'string'
    name: 'string'
    size: 'string'
    tier: 'string'
  }
  tags: {
    {customized property}: 'string'
  }
}

屬性值

Microsoft。Sql/instancePools

名稱 說明 價值
位置 資源所在的地理位置 字串 (必要)
名字 資源名稱 字串 (必要)
屬性 資源屬性。 InstancePoolProperties
sku SKU 的名稱和層。 Sku
標記 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤

InstancePoolProperties

名稱 說明 價值
licenseType 授權類型。 可能的值為 'LicenseIncluded' (包含 SQL 授權的價格)和 'BasePrice' (不含 SQL 授權價格)。 'BasePrice'
'LicenseIncluded' (必要)
maintenanceConfigurationId 指定要套用至這個受控實例的維護組態標識碼。 字串
子網ID 要放置這個實例集區之子網的資源標識符。 字串 (必要)
虛擬核心 屬於這個實例集區的虛擬核心計數。 int (必要)

Sku

名稱 說明 價值
容量 特定 SKU 的容量。 int
family 如果服務有不同世代的硬體,針對相同的 SKU,則可以在這裡擷取。 字串
名字 SKU 的名稱,通常是字母 + 數位碼,例如 P3。 字串 (必要)
尺寸 特定 SKU 的大小 字串
分層 特定 SKU 的階層或版本,例如基本、進階。 字串

TrackedResourceTags

名稱 說明 價值

使用範例

Bicep 範例

部署 SQL 執行個體集區的基本範例。

param resourceName string = 'acctest0001'

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2023-04-01' existing = {
  parent: virtualNetwork
  name: resourceName
}

resource instancePool 'Microsoft.Sql/instancePools@2022-05-01-preview' = {
  name: resourceName
  properties: {
    licenseType: 'LicenseIncluded'
    subnetId: subnet.id
    vCores: 8
  }
  sku: {
    family: 'Gen5'
    name: 'GP_Gen5'
    tier: 'GeneralPurpose'
  }
}

resource networkSecurityGroup 'Microsoft.Network/networkSecurityGroups@2023-04-01' = {
  name: resourceName
  properties: {
    securityRules: [
      {
        name: 'allow_tds_inbound'
        properties: {
          access: 'Allow'
          description: 'Allow access to data'
          destinationAddressPrefix: '*'
          destinationPortRange: '1433'
          direction: 'Inbound'
          priority: 1000
          protocol: 'TCP'
          sourceAddressPrefix: 'VirtualNetwork'
          sourcePortRange: '*'
        }
      }
      {
        name: 'allow_redirect_inbound'
        properties: {
          access: 'Allow'
          description: 'Allow inbound redirect traffic to Managed Instance inside the virtual network'
          destinationAddressPrefix: '*'
          destinationPortRange: '11000-11999'
          direction: 'Inbound'
          priority: 1100
          protocol: 'Tcp'
          sourceAddressPrefix: 'VirtualNetwork'
          sourcePortRange: '*'
        }
      }
      {
        name: 'allow_geodr_inbound'
        properties: {
          access: 'Allow'
          description: 'Allow inbound geodr traffic inside the virtual network'
          destinationAddressPrefix: '*'
          destinationPortRange: '5022'
          direction: 'Inbound'
          priority: 1200
          protocol: 'Tcp'
          sourceAddressPrefix: 'VirtualNetwork'
          sourcePortRange: '*'
        }
      }
      {
        name: 'deny_all_inbound'
        properties: {
          access: 'Deny'
          description: 'Deny all other inbound traffic'
          destinationAddressPrefix: '*'
          destinationPortRange: '*'
          direction: 'Inbound'
          priority: 4096
          protocol: '*'
          sourceAddressPrefix: '*'
          sourcePortRange: '*'
        }
      }
      {
        name: 'allow_linkedserver_outbound'
        properties: {
          access: 'Allow'
          description: 'Allow outbound linkedserver traffic inside the virtual network'
          destinationAddressPrefix: 'VirtualNetwork'
          destinationPortRange: '1433'
          direction: 'Outbound'
          priority: 1000
          protocol: 'Tcp'
          sourceAddressPrefix: '*'
          sourcePortRange: '*'
        }
      }
      {
        name: 'allow_redirect_outbound'
        properties: {
          access: 'Allow'
          description: 'Allow outbound redirect traffic to Managed Instance inside the virtual network'
          destinationAddressPrefix: 'VirtualNetwork'
          destinationPortRange: '11000-11999'
          direction: 'Outbound'
          priority: 1100
          protocol: 'Tcp'
          sourceAddressPrefix: '*'
          sourcePortRange: '*'
        }
      }
      {
        name: 'allow_geodr_outbound'
        properties: {
          access: 'Allow'
          description: 'Allow outbound geodr traffic inside the virtual network'
          destinationAddressPrefix: 'VirtualNetwork'
          destinationPortRange: '5022'
          direction: 'Outbound'
          priority: 1200
          protocol: 'Tcp'
          sourceAddressPrefix: '*'
          sourcePortRange: '*'
        }
      }
      {
        name: 'deny_all_outbound'
        properties: {
          access: 'Deny'
          description: 'Deny all other outbound traffic'
          destinationAddressPrefix: '*'
          destinationPortRange: '*'
          direction: 'Outbound'
          priority: 4096
          protocol: '*'
          sourceAddressPrefix: '*'
          sourcePortRange: '*'
        }
      }
    ]
  }
}

resource routeTable 'Microsoft.Network/routeTables@2023-04-01' = {
  name: resourceName
  properties: {
    disableBgpRoutePropagation: false
  }
}

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2023-04-01' = {
  name: resourceName
  properties: {
    addressSpace: {
      addressPrefixes: [
        '10.0.0.0/16'
      ]
    }
    subnets: [
      {
        name: 'Default'
        properties: {
          addressPrefix: '10.0.0.0/24'
        }
      }
      {
        name: 'acctest0001'
        properties: {
          addressPrefix: '10.0.1.0/24'
          delegations: [
            {
              name: 'miDelegation'
              properties: {
                serviceName: 'Microsoft.Sql/managedInstances'
              }
            }
          ]
          networkSecurityGroup: {
            id: networkSecurityGroup.id
          }
          routeTable: {
            id: routeTable.id
          }
        }
      }
    ]
  }
}

Azure 已驗證的模組

以下的 Azure 已驗證模組 可用於部署此資源類型。

模組 說明
SQL 實例池 SQL 實例集區的 AVM 資源模組

ARM 樣本資源定義

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

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

資源格式

創造一個 Microsoft。Sql/instancePools 資源,請將以下 JSON 加入你的範本。

{
  "type": "Microsoft.Sql/instancePools",
  "apiVersion": "2025-01-01",
  "name": "string",
  "location": "string",
  "properties": {
    "licenseType": "string",
    "maintenanceConfigurationId": "string",
    "subnetId": "string",
    "vCores": "int"
  },
  "sku": {
    "capacity": "int",
    "family": "string",
    "name": "string",
    "size": "string",
    "tier": "string"
  },
  "tags": {
    "{customized property}": "string"
  }
}

屬性值

Microsoft。Sql/instancePools

名稱 說明 價值
apiVersion API 版本 '2025-01-01'
位置 資源所在的地理位置 字串 (必要)
名字 資源名稱 字串 (必要)
屬性 資源屬性。 InstancePoolProperties
sku SKU 的名稱和層。 Sku
標記 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤
型別 資源類型 「Microsoft。Sql/instancePools'

InstancePoolProperties

名稱 說明 價值
licenseType 授權類型。 可能的值為 'LicenseIncluded' (包含 SQL 授權的價格)和 'BasePrice' (不含 SQL 授權價格)。 'BasePrice'
'LicenseIncluded' (必要)
maintenanceConfigurationId 指定要套用至這個受控實例的維護組態標識碼。 字串
子網ID 要放置這個實例集區之子網的資源標識符。 字串 (必要)
虛擬核心 屬於這個實例集區的虛擬核心計數。 int (必要)

Sku

名稱 說明 價值
容量 特定 SKU 的容量。 int
family 如果服務有不同世代的硬體,針對相同的 SKU,則可以在這裡擷取。 字串
名字 SKU 的名稱,通常是字母 + 數位碼,例如 P3。 字串 (必要)
尺寸 特定 SKU 的大小 字串
分層 特定 SKU 的階層或版本,例如基本、進階。 字串

TrackedResourceTags

名稱 說明 價值

使用範例

Terraform (AzAPI 提供者) 資源定義

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

  • 資源群組

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

資源格式

創造一個 Microsoft。Sql/instancePool 資源,將以下 Terraform 加入你的範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Sql/instancePools@2025-01-01"
  name = "string"
  parent_id = "string"
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      licenseType = "string"
      maintenanceConfigurationId = "string"
      subnetId = "string"
      vCores = int
    }
    sku = {
      capacity = int
      family = "string"
      name = "string"
      size = "string"
      tier = "string"
    }
  }
}

屬性值

Microsoft。Sql/instancePools

名稱 說明 價值
位置 資源所在的地理位置 字串 (必要)
名字 資源名稱 字串 (必要)
屬性 資源屬性。 InstancePoolProperties
sku SKU 的名稱和層。 Sku
標記 資源標籤 標記名稱和值的字典。
型別 資源類型 「Microsoft。Sql/instancePools@2025-01-01”

InstancePoolProperties

名稱 說明 價值
licenseType 授權類型。 可能的值為 'LicenseIncluded' (包含 SQL 授權的價格)和 'BasePrice' (不含 SQL 授權價格)。 'BasePrice'
'LicenseIncluded' (必要)
maintenanceConfigurationId 指定要套用至這個受控實例的維護組態標識碼。 字串
子網ID 要放置這個實例集區之子網的資源標識符。 字串 (必要)
虛擬核心 屬於這個實例集區的虛擬核心計數。 int (必要)

Sku

名稱 說明 價值
容量 特定 SKU 的容量。 int
family 如果服務有不同世代的硬體,針對相同的 SKU,則可以在這裡擷取。 字串
名字 SKU 的名稱,通常是字母 + 數位碼,例如 P3。 字串 (必要)
尺寸 特定 SKU 的大小 字串
分層 特定 SKU 的階層或版本,例如基本、進階。 字串

TrackedResourceTags

名稱 說明 價值

使用範例

Terraform 範例

部署 SQL 執行個體集區的基本範例。

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"
}

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

resource "azapi_resource" "networkSecurityGroup" {
  type      = "Microsoft.Network/networkSecurityGroups@2023-04-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = azapi_resource.resourceGroup.location
  body = {
    properties = {
      securityRules = [
        {
          name = "allow_tds_inbound"
          properties = {
            description              = "Allow access to data"
            protocol                 = "TCP"
            sourcePortRange          = "*"
            destinationPortRange     = "1433"
            sourceAddressPrefix      = "VirtualNetwork"
            destinationAddressPrefix = "*"
            access                   = "Allow"
            priority                 = 1000
            direction                = "Inbound"
          }
        },
        {
          name = "allow_redirect_inbound"
          properties = {
            description              = "Allow inbound redirect traffic to Managed Instance inside the virtual network"
            protocol                 = "Tcp"
            sourcePortRange          = "*"
            destinationPortRange     = "11000-11999"
            sourceAddressPrefix      = "VirtualNetwork"
            destinationAddressPrefix = "*"
            access                   = "Allow"
            priority                 = 1100
            direction                = "Inbound"
          }
        },
        {
          name = "allow_geodr_inbound"
          properties = {
            description              = "Allow inbound geodr traffic inside the virtual network"
            protocol                 = "Tcp"
            sourcePortRange          = "*"
            destinationPortRange     = "5022"
            sourceAddressPrefix      = "VirtualNetwork"
            destinationAddressPrefix = "*"
            access                   = "Allow"
            priority                 = 1200
            direction                = "Inbound"
          }
        },
        {
          name = "deny_all_inbound"
          properties = {
            description              = "Deny all other inbound traffic"
            protocol                 = "*"
            sourcePortRange          = "*"
            destinationPortRange     = "*"
            sourceAddressPrefix      = "*"
            destinationAddressPrefix = "*"
            access                   = "Deny"
            priority                 = 4096
            direction                = "Inbound"
          }
        },
        {
          name = "allow_linkedserver_outbound"
          properties = {
            description              = "Allow outbound linkedserver traffic inside the virtual network"
            protocol                 = "Tcp"
            sourcePortRange          = "*"
            destinationPortRange     = "1433"
            sourceAddressPrefix      = "*"
            destinationAddressPrefix = "VirtualNetwork"
            access                   = "Allow"
            priority                 = 1000
            direction                = "Outbound"
          }
        },
        {
          name = "allow_redirect_outbound"
          properties = {
            description              = "Allow outbound redirect traffic to Managed Instance inside the virtual network"
            protocol                 = "Tcp"
            sourcePortRange          = "*"
            destinationPortRange     = "11000-11999"
            sourceAddressPrefix      = "*"
            destinationAddressPrefix = "VirtualNetwork"
            access                   = "Allow"
            priority                 = 1100
            direction                = "Outbound"
          }
        },
        {
          name = "allow_geodr_outbound"
          properties = {
            description              = "Allow outbound geodr traffic inside the virtual network"
            protocol                 = "Tcp"
            sourcePortRange          = "*"
            destinationPortRange     = "5022"
            sourceAddressPrefix      = "*"
            destinationAddressPrefix = "VirtualNetwork"
            access                   = "Allow"
            priority                 = 1200
            direction                = "Outbound"
          }
        },
        {
          name = "deny_all_outbound"
          properties = {
            description              = "Deny all other outbound traffic"
            protocol                 = "*"
            sourcePortRange          = "*"
            destinationPortRange     = "*"
            sourceAddressPrefix      = "*"
            destinationAddressPrefix = "*"
            access                   = "Deny"
            priority                 = 4096
            direction                = "Outbound"
          }
        }
      ]
    }
  }
}

resource "azapi_resource" "routeTable" {
  type      = "Microsoft.Network/routeTables@2023-04-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = azapi_resource.resourceGroup.location
  body = {
    properties = {
      disableBgpRoutePropagation = false
    }
  }
}

resource "azapi_resource" "virtualNetwork" {
  type      = "Microsoft.Network/virtualNetworks@2023-04-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = azapi_resource.resourceGroup.location
  body = {
    properties = {
      addressSpace = {
        addressPrefixes = ["10.0.0.0/16"]
      }
      subnets = [
        {
          name = "Default"
          properties = {
            addressPrefix = "10.0.0.0/24"
          }
        },
        {
          name = var.resource_name
          properties = {
            addressPrefix = "10.0.1.0/24"
            networkSecurityGroup = {
              id = azapi_resource.networkSecurityGroup.id
            }
            routeTable = {
              id = azapi_resource.routeTable.id
            }
            delegations = [
              {
                name = "miDelegation"
                properties = {
                  serviceName = "Microsoft.Sql/managedInstances"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

data "azapi_resource" "subnet" {
  type      = "Microsoft.Network/virtualNetworks/subnets@2023-04-01"
  parent_id = azapi_resource.virtualNetwork.id
  name      = var.resource_name
}


resource "azapi_resource" "instancePool" {
  type      = "Microsoft.Sql/instancePools@2022-05-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = azapi_resource.resourceGroup.location
  body = {
    properties = {
      licenseType = "LicenseIncluded"
      subnetId    = data.azapi_resource.subnet.id
      vCores      = 8
    }
    sku = {
      family = "Gen5"
      name   = "GP_Gen5"
      tier   = "GeneralPurpose"
    }
  }

  timeouts {
    create = "300m"
    update = "300m"
    delete = "300m"
  }
}