Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Bicep resource definition
The flexibleServers/firewallRules resource type can be deployed with operations that target:
- Resource groups - See resource group deployment commands
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.DBforPostgreSQL/flexibleServers/firewallRules resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2025-06-01-preview' = {
parent: resourceSymbolicName
name: 'string'
properties: {
endIpAddress: 'string'
startIpAddress: 'string'
}
}
Property Values
Microsoft.DBforPostgreSQL/flexibleServers/firewallRules
| Name | Description | Value |
|---|---|---|
| name | The resource name | string Constraints: Min length = 1 Max length = 80 Pattern = ^[a-zA-Z0-9][-_a-zA-Z0-9]{0,79}(?<!-)$ (required) |
| parent | In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource. For more information, see Child resource outside parent resource. |
Symbolic name for resource of type: flexibleServers |
| properties | Properties of a firewall rule. | FirewallRuleProperties (required) |
FirewallRuleProperties
| Name | Description | Value |
|---|---|---|
| endIpAddress | IP address defining the end of the range of addresses of a firewall rule. Must be expressed in IPv4 format. | string Constraints: Pattern = ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (required) |
| startIpAddress | IP address defining the start of the range of addresses of a firewall rule. Must be expressed in IPv4 format. | string Constraints: Pattern = ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (required) |
Usage Examples
Bicep Samples
A basic example of deploying PostgreSQL Flexible Server Firewall Rule.
param resourceName string = 'acctest0001'
param location string = 'westeurope'
@secure()
@description('The administrator password for the PostgreSQL flexible server')
param postgresqlAdministratorPassword string
resource flexibleServer 'Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01' = {
name: resourceName
location: location
properties: {
administratorLogin: 'adminTerraform'
administratorLoginPassword: null
availabilityZone: '2'
backup: {
geoRedundantBackup: 'Disabled'
}
highAvailability: {
mode: 'Disabled'
}
network: {}
storage: {
storageSizeGB: 32
}
version: '12'
}
sku: {
name: 'Standard_D2s_v3'
tier: 'GeneralPurpose'
}
}
resource firewallRule 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2022-12-01' = {
parent: flexibleServer
name: resourceName
properties: {
endIpAddress: '122.122.0.0'
startIpAddress: '122.122.0.0'
}
}
ARM template resource definition
The flexibleServers/firewallRules resource type can be deployed with operations that target:
- Resource groups - See resource group deployment commands
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.DBforPostgreSQL/flexibleServers/firewallRules resource, add the following JSON to your template.
{
"type": "Microsoft.DBforPostgreSQL/flexibleServers/firewallRules",
"apiVersion": "2025-06-01-preview",
"name": "string",
"properties": {
"endIpAddress": "string",
"startIpAddress": "string"
}
}
Property Values
Microsoft.DBforPostgreSQL/flexibleServers/firewallRules
| Name | Description | Value |
|---|---|---|
| apiVersion | The api version | '2025-06-01-preview' |
| name | The resource name | string Constraints: Min length = 1 Max length = 80 Pattern = ^[a-zA-Z0-9][-_a-zA-Z0-9]{0,79}(?<!-)$ (required) |
| properties | Properties of a firewall rule. | FirewallRuleProperties (required) |
| type | The resource type | 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules' |
FirewallRuleProperties
| Name | Description | Value |
|---|---|---|
| endIpAddress | IP address defining the end of the range of addresses of a firewall rule. Must be expressed in IPv4 format. | string Constraints: Pattern = ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (required) |
| startIpAddress | IP address defining the start of the range of addresses of a firewall rule. Must be expressed in IPv4 format. | string Constraints: Pattern = ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (required) |
Usage Examples
Terraform (AzAPI provider) resource definition
The flexibleServers/firewallRules resource type can be deployed with operations that target:
- Resource groups
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.DBforPostgreSQL/flexibleServers/firewallRules resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2025-06-01-preview"
name = "string"
parent_id = "string"
body = {
properties = {
endIpAddress = "string"
startIpAddress = "string"
}
}
}
Property Values
Microsoft.DBforPostgreSQL/flexibleServers/firewallRules
| Name | Description | Value |
|---|---|---|
| name | The resource name | string Constraints: Min length = 1 Max length = 80 Pattern = ^[a-zA-Z0-9][-_a-zA-Z0-9]{0,79}(?<!-)$ (required) |
| parent_id | The ID of the resource that is the parent for this resource. | ID for resource of type: flexibleServers |
| properties | Properties of a firewall rule. | FirewallRuleProperties (required) |
| type | The resource type | "Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2025-06-01-preview" |
FirewallRuleProperties
| Name | Description | Value |
|---|---|---|
| endIpAddress | IP address defining the end of the range of addresses of a firewall rule. Must be expressed in IPv4 format. | string Constraints: Pattern = ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (required) |
| startIpAddress | IP address defining the start of the range of addresses of a firewall rule. Must be expressed in IPv4 format. | string Constraints: Pattern = ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (required) |
Usage Examples
Terraform Samples
A basic example of deploying PostgreSQL Flexible Server Firewall Rule.
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 "postgresql_administrator_password" {
type = string
description = "The administrator password for the PostgreSQL flexible server"
sensitive = true
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "flexibleServer" {
type = "Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
administratorLogin = "adminTerraform"
administratorLoginPassword = var.postgresql_administrator_password
availabilityZone = "2"
backup = {
geoRedundantBackup = "Disabled"
}
highAvailability = {
mode = "Disabled"
}
network = {
}
storage = {
storageSizeGB = 32
}
version = "12"
}
sku = {
name = "Standard_D2s_v3"
tier = "GeneralPurpose"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "firewallRule" {
type = "Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2022-12-01"
parent_id = azapi_resource.flexibleServer.id
name = var.resource_name
body = {
properties = {
endIpAddress = "122.122.0.0"
startIpAddress = "122.122.0.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}