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 resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.DBforPostgreSQL/flexibleServers resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.DBforPostgreSQL/flexibleServers@2022-01-20-preview' = {
scope: resourceSymbolicName or scope
location: 'string'
name: 'string'
properties: {
administratorLogin: 'string'
administratorLoginPassword: 'string'
availabilityZone: 'string'
backup: {
backupRetentionDays: int
geoRedundantBackup: 'string'
}
createMode: 'string'
highAvailability: {
mode: 'string'
standbyAvailabilityZone: 'string'
}
maintenanceWindow: {
customWindow: 'string'
dayOfWeek: int
startHour: int
startMinute: int
}
network: {
delegatedSubnetResourceId: 'string'
privateDnsZoneArmResourceId: 'string'
}
pointInTimeUTC: 'string'
sourceServerResourceId: 'string'
storage: {
storageSizeGB: int
}
version: 'string'
}
sku: {
name: 'string'
tier: 'string'
}
tags: {
{customized property}: 'string'
}
}
Property Values
Microsoft.DBforPostgreSQL/flexibleServers
| Name | Description | Value |
|---|---|---|
| location | The geo-location where the resource lives | string (required) |
| name | The resource name | string (required) |
| properties | Properties of the server. | ServerProperties |
| scope | Use when creating a resource at a scope that is different than the deployment scope. | Set this property to the symbolic name of a resource to apply the extension resource. |
| sku | The SKU (pricing tier) of the server. | Sku |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
Backup
| Name | Description | Value |
|---|---|---|
| backupRetentionDays | Backup retention days for the server. | int |
| geoRedundantBackup | A value indicating whether Geo-Redundant backup is enabled on the server. | 'Disabled' 'Enabled' |
HighAvailability
| Name | Description | Value |
|---|---|---|
| mode | The HA mode for the server. | 'Disabled' 'SameZone' 'ZoneRedundant' |
| standbyAvailabilityZone | availability zone information of the standby. | string |
MaintenanceWindow
| Name | Description | Value |
|---|---|---|
| customWindow | indicates whether custom window is enabled or disabled | string |
| dayOfWeek | day of week for maintenance window | int |
| startHour | start hour for maintenance window | int |
| startMinute | start minute for maintenance window | int |
Network
| Name | Description | Value |
|---|---|---|
| delegatedSubnetResourceId | delegated subnet arm resource id. | string |
| privateDnsZoneArmResourceId | private dns zone arm resource id. | string |
ServerProperties
| Name | Description | Value |
|---|---|---|
| administratorLogin | The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). | string |
| administratorLoginPassword | The administrator login password (required for server creation). | string Constraints: Sensitive value. Pass in as a secure parameter. |
| availabilityZone | availability zone information of the server. | string |
| backup | Backup properties of a server. | Backup |
| createMode | The mode to create a new PostgreSQL server. | 'Create' 'Default' 'PointInTimeRestore' 'Update' |
| highAvailability | High availability properties of a server. | HighAvailability |
| maintenanceWindow | Maintenance window properties of a server. | MaintenanceWindow |
| network | Network properties of a server. | Network |
| pointInTimeUTC | Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore'. | string |
| sourceServerResourceId | The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore'. | string |
| storage | Storage properties of a server. | Storage |
| version | PostgreSQL Server version. | '11' '12' '13' '14' |
Sku
| Name | Description | Value |
|---|---|---|
| name | The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. | string (required) |
| tier | The tier of the particular SKU, e.g. Burstable. | 'Burstable' 'GeneralPurpose' 'MemoryOptimized' (required) |
Storage
| Name | Description | Value |
|---|---|---|
| storageSizeGB | Max storage allowed for a server. | int |
TrackedResourceTags
| Name | Description | Value |
|---|
Usage Examples
Azure Verified Modules
The following Azure Verified Modules can be used to deploy this resource type.
| Module | Description |
|---|---|
| DB for Postgre SQL Flexible Server | AVM Resource Module for DB for Postgre SQL Flexible Server |
Azure Quickstart Samples
The following Azure Quickstart templates contain Bicep samples for deploying this resource type.
| Bicep File | Description |
|---|---|
| Create PgFlex server & enable protection via Backup Vault | Template that creates a PostgreSQL Flexible Server and enables protection via Backup Vault |
| Deploy Azure Database for PostgreSQL (flexible) with AAD | This template provides a way to deploy a Flexible server Azure database for PostgreSQL with AAD integration. |
| Deploy Azure Database for PostgreSQL (flexible) with VNet | This template provides a way to deploy a Flexible server Azure database for PostgreSQL with VNet integration. |
| SonarQube on Web App with PostgreSQL and VNet integration | This template provides easy to deploy SonarQube to Web App on Linux with PostgreSQL Flexible Server, VNet integration and private DNS. |
ARM template resource definition
The flexibleServers resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.DBforPostgreSQL/flexibleServers resource, add the following JSON to your template.
{
"type": "Microsoft.DBforPostgreSQL/flexibleServers",
"apiVersion": "2022-01-20-preview",
"name": "string",
"location": "string",
"properties": {
"administratorLogin": "string",
"administratorLoginPassword": "string",
"availabilityZone": "string",
"backup": {
"backupRetentionDays": "int",
"geoRedundantBackup": "string"
},
"createMode": "string",
"highAvailability": {
"mode": "string",
"standbyAvailabilityZone": "string"
},
"maintenanceWindow": {
"customWindow": "string",
"dayOfWeek": "int",
"startHour": "int",
"startMinute": "int"
},
"network": {
"delegatedSubnetResourceId": "string",
"privateDnsZoneArmResourceId": "string"
},
"pointInTimeUTC": "string",
"sourceServerResourceId": "string",
"storage": {
"storageSizeGB": "int"
},
"version": "string"
},
"sku": {
"name": "string",
"tier": "string"
},
"tags": {
"{customized property}": "string"
}
}
Property Values
Microsoft.DBforPostgreSQL/flexibleServers
| Name | Description | Value |
|---|---|---|
| apiVersion | The api version | '2022-01-20-preview' |
| location | The geo-location where the resource lives | string (required) |
| name | The resource name | string (required) |
| properties | Properties of the server. | ServerProperties |
| sku | The SKU (pricing tier) of the server. | Sku |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
| type | The resource type | 'Microsoft.DBforPostgreSQL/flexibleServers' |
Backup
| Name | Description | Value |
|---|---|---|
| backupRetentionDays | Backup retention days for the server. | int |
| geoRedundantBackup | A value indicating whether Geo-Redundant backup is enabled on the server. | 'Disabled' 'Enabled' |
HighAvailability
| Name | Description | Value |
|---|---|---|
| mode | The HA mode for the server. | 'Disabled' 'SameZone' 'ZoneRedundant' |
| standbyAvailabilityZone | availability zone information of the standby. | string |
MaintenanceWindow
| Name | Description | Value |
|---|---|---|
| customWindow | indicates whether custom window is enabled or disabled | string |
| dayOfWeek | day of week for maintenance window | int |
| startHour | start hour for maintenance window | int |
| startMinute | start minute for maintenance window | int |
Network
| Name | Description | Value |
|---|---|---|
| delegatedSubnetResourceId | delegated subnet arm resource id. | string |
| privateDnsZoneArmResourceId | private dns zone arm resource id. | string |
ServerProperties
| Name | Description | Value |
|---|---|---|
| administratorLogin | The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). | string |
| administratorLoginPassword | The administrator login password (required for server creation). | string Constraints: Sensitive value. Pass in as a secure parameter. |
| availabilityZone | availability zone information of the server. | string |
| backup | Backup properties of a server. | Backup |
| createMode | The mode to create a new PostgreSQL server. | 'Create' 'Default' 'PointInTimeRestore' 'Update' |
| highAvailability | High availability properties of a server. | HighAvailability |
| maintenanceWindow | Maintenance window properties of a server. | MaintenanceWindow |
| network | Network properties of a server. | Network |
| pointInTimeUTC | Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore'. | string |
| sourceServerResourceId | The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore'. | string |
| storage | Storage properties of a server. | Storage |
| version | PostgreSQL Server version. | '11' '12' '13' '14' |
Sku
| Name | Description | Value |
|---|---|---|
| name | The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. | string (required) |
| tier | The tier of the particular SKU, e.g. Burstable. | 'Burstable' 'GeneralPurpose' 'MemoryOptimized' (required) |
Storage
| Name | Description | Value |
|---|---|---|
| storageSizeGB | Max storage allowed for a server. | int |
TrackedResourceTags
| Name | Description | Value |
|---|
Usage Examples
Azure Quickstart Templates
The following Azure Quickstart templates deploy this resource type.
| Template | Description |
|---|---|
| Create PgFlex server & enable protection via Backup Vault |
Template that creates a PostgreSQL Flexible Server and enables protection via Backup Vault |
| Deploy Azure Database for PostgreSQL (flexible) with AAD |
This template provides a way to deploy a Flexible server Azure database for PostgreSQL with AAD integration. |
| Deploy Azure Database for PostgreSQL (flexible) with VNet |
This template provides a way to deploy a Flexible server Azure database for PostgreSQL with VNet integration. |
| SonarQube on Web App with PostgreSQL and VNet integration |
This template provides easy to deploy SonarQube to Web App on Linux with PostgreSQL Flexible Server, VNet integration and private DNS. |
Terraform (AzAPI provider) resource definition
The flexibleServers resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.DBforPostgreSQL/flexibleServers resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DBforPostgreSQL/flexibleServers@2022-01-20-preview"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
administratorLogin = "string"
administratorLoginPassword = "string"
availabilityZone = "string"
backup = {
backupRetentionDays = int
geoRedundantBackup = "string"
}
createMode = "string"
highAvailability = {
mode = "string"
standbyAvailabilityZone = "string"
}
maintenanceWindow = {
customWindow = "string"
dayOfWeek = int
startHour = int
startMinute = int
}
network = {
delegatedSubnetResourceId = "string"
privateDnsZoneArmResourceId = "string"
}
pointInTimeUTC = "string"
sourceServerResourceId = "string"
storage = {
storageSizeGB = int
}
version = "string"
}
sku = {
name = "string"
tier = "string"
}
}
}
Property Values
Microsoft.DBforPostgreSQL/flexibleServers
| Name | Description | Value |
|---|---|---|
| location | The geo-location where the resource lives | string (required) |
| name | The resource name | string (required) |
| parent_id | The ID of the resource to apply this extension resource to. | string (required) |
| properties | Properties of the server. | ServerProperties |
| sku | The SKU (pricing tier) of the server. | Sku |
| tags | Resource tags | Dictionary of tag names and values. |
| type | The resource type | "Microsoft.DBforPostgreSQL/flexibleServers@2022-01-20-preview" |
Backup
| Name | Description | Value |
|---|---|---|
| backupRetentionDays | Backup retention days for the server. | int |
| geoRedundantBackup | A value indicating whether Geo-Redundant backup is enabled on the server. | 'Disabled' 'Enabled' |
HighAvailability
| Name | Description | Value |
|---|---|---|
| mode | The HA mode for the server. | 'Disabled' 'SameZone' 'ZoneRedundant' |
| standbyAvailabilityZone | availability zone information of the standby. | string |
MaintenanceWindow
| Name | Description | Value |
|---|---|---|
| customWindow | indicates whether custom window is enabled or disabled | string |
| dayOfWeek | day of week for maintenance window | int |
| startHour | start hour for maintenance window | int |
| startMinute | start minute for maintenance window | int |
Network
| Name | Description | Value |
|---|---|---|
| delegatedSubnetResourceId | delegated subnet arm resource id. | string |
| privateDnsZoneArmResourceId | private dns zone arm resource id. | string |
ServerProperties
| Name | Description | Value |
|---|---|---|
| administratorLogin | The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). | string |
| administratorLoginPassword | The administrator login password (required for server creation). | string Constraints: Sensitive value. Pass in as a secure parameter. |
| availabilityZone | availability zone information of the server. | string |
| backup | Backup properties of a server. | Backup |
| createMode | The mode to create a new PostgreSQL server. | 'Create' 'Default' 'PointInTimeRestore' 'Update' |
| highAvailability | High availability properties of a server. | HighAvailability |
| maintenanceWindow | Maintenance window properties of a server. | MaintenanceWindow |
| network | Network properties of a server. | Network |
| pointInTimeUTC | Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore'. | string |
| sourceServerResourceId | The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore'. | string |
| storage | Storage properties of a server. | Storage |
| version | PostgreSQL Server version. | '11' '12' '13' '14' |
Sku
| Name | Description | Value |
|---|---|---|
| name | The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. | string (required) |
| tier | The tier of the particular SKU, e.g. Burstable. | 'Burstable' 'GeneralPurpose' 'MemoryOptimized' (required) |
Storage
| Name | Description | Value |
|---|---|---|
| storageSizeGB | Max storage allowed for a server. | int |
TrackedResourceTags
| Name | Description | Value |
|---|
Usage Examples
Terraform Samples
A basic example of deploying PostgreSQL Flexible 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 = "eastus"
}
variable "administrator_login" {
type = string
description = "The administrator login name for the PostgreSQL flexible server"
}
variable "administrator_login_password" {
type = string
description = "The administrator login 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@2023-06-01-preview"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
identity = {
type = "None",
userAssignedIdentities = null
},
properties = {
administratorLogin = var.administrator_login
administratorLoginPassword = var.administrator_login_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 = ["*"]
}
Azure Verified Modules
The following Azure Verified Modules can be used to deploy this resource type.
| Module | Description |
|---|---|
| DB for Postgre SQL Flexible Server | AVM Resource Module for DB for Postgre SQL Flexible Server |