- Latest
- 2026-08-01-預覽
- 2025-08-01-預覽
- 2025-02-01-preview
- 2025-01-01
- 2024-11-01-preview
- 2024-05-01-preview
- 2023-08-01
- 2023-08-01-preview
- 2023-05-01-preview
- 2023-02-01-preview
- 2022-11-01-preview
- 2022-08-01-preview
- 2022-05-01-preview
- 2022-02-01-preview
- 2021-11-01
- 2021-11-01-preview
- 2021-08-01-preview
- 2021-05-01-preview
- 2021-02-01-preview
- 2020-11-01-preview
- 2020-08-01-preview
- 2020-02-02-preview
- 2015-05-01-preview
- 2014-04-01
Bicep 資源定義
伺服器/firewallRules 資源類型可以使用目標作業來部署:
- 資源群組 - 請參閱 資源群組部署命令
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
使用範例
Bicep 範例
部署 Azure SQL 防火牆規則的基本範例。
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: 'msincredible'
administratorLoginPassword: administratorLoginPassword
minimalTlsVersion: '1.2'
publicNetworkAccess: 'Enabled'
restrictOutboundNetworkAccess: 'Disabled'
version: '12.0'
}
}
resource firewallRule 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = {
name: resourceName
parent: server
properties: {
endIpAddress: '255.255.255.255'
startIpAddress: '0.0.0.0'
}
}
Azure 快速入門範例
以下的 Azure 快速啟動範本包含部署此資源類型的Bicep範例。
| Bicep檔案 | Description |
|---|---|
| 建立一個啟用 ADLS Gen 2 的 Azure 儲存帳號,一個 Azure Data Factory 實例,並連結服務給該儲存帳號(若部署則是 Azure SQL Database),以及一個 Azure Databricks 實例。 部署範本和 ADF 實例受控識別的使用者 AAD 身分識別,將會在記憶體帳戶上授與記憶體 Blob 數據參與者角色。 也有部署 Azure Key Vault 實例、Azure SQL Database 和 Azure Event Hub(用於串流使用案例)的選項。 當 Azure Key Vault 部署時,部署該範本的使用者的資料工廠管理身份與 AAD 身份會被授予 金鑰保存庫 Secrets 使用者角色。 | |
| 使用 SQL Database 布建 Web 應用程式 | 此範本會布建 Web 應用程式、SQL Database、自動調整設定、警示規則和 App Insights。 它會在網頁應用程式中為資料庫配置一個 連接字串。 |
| 使用 Azure SQL 在 Linux 上 Sonarqube Docker Web 應用程式 | 此範本會將 Sonarqube 部署於 Azure App 服務 網頁應用 Linux 容器中,使用官方 Sonarqube 映像檔,並由 Azure SQL Server 支援。 |
| SQL 邏輯伺服器 | 此範本可讓您建立 SQL 邏輯伺服器。 |
| Web 應用程式,採用管理身份、SQL Server 與 ΑΙ | 簡單範例,用於部署 Azure 基礎設施以支援應用程式 + data + managed identity + monitoring |
資源格式
創造一個 Microsoft。Sql/servers/firewallRules 資源,請在你的範本中加入以下 Bicep。
resource symbolicname 'Microsoft.Sql/servers/firewallRules@2026-08-01-preview' = {
parent: resourceSymbolicName
name: 'string'
properties: {
endIpAddress: 'string'
startIpAddress: 'string'
}
}
屬性值
Microsoft。Sql/servers/firewallRules
| Name | Description | Value |
|---|---|---|
| name | 資源名稱 | 字串 (必要) |
| 父代 | 在 Bicep 中,你可以指定子資源的父資源。 只有在父資源外部宣告子資源時,才需要新增這個屬性。 如需詳細資訊,請參閱 父資源外部的子資源。 |
類型的資源符號名稱:伺服器 |
| properties | 資源屬性。 | ServerFirewallRuleProperties |
ServerFirewallRuleProperties
| Name | Description | Value |
|---|---|---|
| endIpAddress | 防火牆規則的結束IP位址。 必須是 IPv4 格式。 必須大於或等於 startIpAddress。 所有 Azure 內部 IP 位址都用值 '0.0.0.0'。 | 字串 |
| startIpAddress | 防火牆規則的起始IP位址。 必須是 IPv4 格式。 所有 Azure 內部 IP 位址都用值 '0.0.0.0'。 | 字串 |
ARM 樣本資源定義
伺服器/firewallRules 資源類型可以使用目標作業來部署:
使用範例
Azure Quickstart templates
以下的 Azure 快速起始範本部署此資源類型。
| Template | Description |
|---|---|
|
部署新的 SQL 彈性池 |
此範本允許您部署新的 SQL 彈性池,並附帶其新關聯的 SQL Server 及可指派的新 SQL 資料庫。 |
| 建立一個啟用 ADLS Gen 2 的 Azure 儲存帳號,一個 Azure Data Factory 實例,並連結服務給該儲存帳號(若部署則是 Azure SQL Database),以及一個 Azure Databricks 實例。 部署範本和 ADF 實例受控識別的使用者 AAD 身分識別,將會在記憶體帳戶上授與記憶體 Blob 數據參與者角色。 也有部署 Azure Key Vault 實例、Azure SQL Database 和 Azure Event Hub(用於串流使用案例)的選項。 當 Azure Key Vault 部署時,部署該範本的使用者的資料工廠管理身份與 AAD 身份會被授予 金鑰保存庫 Secrets 使用者角色。 | |
|
使用 SQL Database 布建 Web 應用程式 |
此範本會布建 Web 應用程式、SQL Database、自動調整設定、警示規則和 App Insights。 它會在網頁應用程式中為資料庫配置一個 連接字串。 |
| 使用 Azure SQL 在 Linux 上 Sonarqube Docker Web 應用程式 |
此範本會將 Sonarqube 部署於 Azure App 服務 網頁應用 Linux 容器中,使用官方 Sonarqube 映像檔,並由 Azure SQL Server 支援。 |
|
SQL 邏輯伺服器 |
此範本可讓您建立 SQL 邏輯伺服器。 |
|
Web 應用程式,採用管理身份、SQL Server 與 ΑΙ |
簡單範例,用於部署 Azure 基礎設施以支援應用程式 + data + managed identity + monitoring |
資源格式
創造一個 Microsoft。Sql/servers/firewallRules 資源,請在你的範本中加入以下 JSON 檔案。
{
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2026-08-01-preview",
"name": "string",
"properties": {
"endIpAddress": "string",
"startIpAddress": "string"
}
}
屬性值
Microsoft。Sql/servers/firewallRules
| Name | Description | Value |
|---|---|---|
| apiVersion | API 版本 | 『2026-08-01-預覽』 |
| name | 資源名稱 | 字串 (必要) |
| properties | 資源屬性。 | ServerFirewallRuleProperties |
| 型別 | 資源類型 | 「Microsoft。Sql/servers/firewallRules' |
ServerFirewallRuleProperties
| Name | Description | Value |
|---|---|---|
| endIpAddress | 防火牆規則的結束IP位址。 必須是 IPv4 格式。 必須大於或等於 startIpAddress。 所有 Azure 內部 IP 位址都用值 '0.0.0.0'。 | 字串 |
| startIpAddress | 防火牆規則的起始IP位址。 必須是 IPv4 格式。 所有 Azure 內部 IP 位址都用值 '0.0.0.0'。 | 字串 |
Terraform (AzAPI 提供者) 資源定義
伺服器/firewallRules 資源類型可以使用目標作業來部署:
- 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。
使用範例
Terraform 範例
部署 Azure SQL 防火牆規則的基本範例。
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"
}
variable "administrator_login_password" {
type = string
description = "The administrator login password for the SQL server"
sensitive = true
}
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 = "msincredible"
administratorLoginPassword = var.administrator_login_password
minimalTlsVersion = "1.2"
publicNetworkAccess = "Enabled"
restrictOutboundNetworkAccess = "Disabled"
version = "12.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "firewallRule" {
type = "Microsoft.Sql/servers/firewallRules@2020-11-01-preview"
parent_id = azapi_resource.server.id
name = var.resource_name
body = {
properties = {
endIpAddress = "255.255.255.255"
startIpAddress = "0.0.0.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
部署 Azure SQL 防火牆規則的基本範例。
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"
}
variable "administrator_login_password" {
type = string
description = "The administrator login password for the SQL server"
sensitive = true
}
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 = "msincredible"
administratorLoginPassword = var.administrator_login_password
minimalTlsVersion = "1.2"
publicNetworkAccess = "Enabled"
restrictOutboundNetworkAccess = "Disabled"
version = "12.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "firewallRule" {
type = "Microsoft.Sql/servers/firewallRules@2020-11-01-preview"
parent_id = azapi_resource.server.id
name = var.resource_name
body = {
properties = {
endIpAddress = "255.255.255.255"
startIpAddress = "0.0.0.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
資源格式
創造一個 Microsoft。Sql/servers/firewallRules 資源,將以下 Terraform 加入你的範本。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Sql/servers/firewallRules@2026-08-01-preview"
name = "string"
parent_id = "string"
body = {
properties = {
endIpAddress = "string"
startIpAddress = "string"
}
}
}
屬性值
Microsoft。Sql/servers/firewallRules
| Name | Description | Value |
|---|---|---|
| name | 資源名稱 | 字串 (必要) |
| parent_id | 此資源為父系之資源的標識碼。 | 類型資源的標識碼:伺服器 |
| properties | 資源屬性。 | ServerFirewallRuleProperties |
| 型別 | 資源類型 | 「Microsoft。Sql/servers/firewallRules@2026-08-01-preview」 |
ServerFirewallRuleProperties
| Name | Description | Value |
|---|---|---|
| endIpAddress | 防火牆規則的結束IP位址。 必須是 IPv4 格式。 必須大於或等於 startIpAddress。 所有 Azure 內部 IP 位址都用值 '0.0.0.0'。 | 字串 |
| startIpAddress | 防火牆規則的起始IP位址。 必須是 IPv4 格式。 所有 Azure 內部 IP 位址都用值 '0.0.0.0'。 | 字串 |