Share via


Microsoft.DBforPostgreSQL flexibleServers/databases

Bicep resource definition

The flexibleServers/databases 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/databases resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.DBforPostgreSQL/flexibleServers/databases@2026-01-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    charset: 'string'
    collation: 'string'
  }
}

Property Values

Microsoft.DBforPostgreSQL/flexibleServers/databases

Name Description Value
name The resource name string

Constraints:
Min length = 1
Max length = 63
Pattern = ^[a-zA-Z_][\w\-]{0,62}$ (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 database. DatabaseProperties

DatabaseProperties

Name Description Value
charset Character set of the database. string

Constraints:
Pattern = ^[a-zA-Z]+\w*$
collation Collation of the database. string

Constraints:
Pattern = ^[a-zA-Z\-]+([. ]|\w)*$

Usage Examples

Bicep Samples

A basic example of deploying PostgreSQL Flexible Server Database.

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 database 'Microsoft.DBforPostgreSQL/flexibleServers/databases@2022-12-01' = {
  parent: flexibleServer
  name: resourceName
  properties: {
    charset: 'UTF8'
    collation: 'en_US.UTF8'
  }
}

ARM template resource definition

The flexibleServers/databases 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/databases resource, add the following JSON to your template.

{
  "type": "Microsoft.DBforPostgreSQL/flexibleServers/databases",
  "apiVersion": "2026-01-01-preview",
  "name": "string",
  "properties": {
    "charset": "string",
    "collation": "string"
  }
}

Property Values

Microsoft.DBforPostgreSQL/flexibleServers/databases

Name Description Value
apiVersion The api version '2026-01-01-preview'
name The resource name string

Constraints:
Min length = 1
Max length = 63
Pattern = ^[a-zA-Z_][\w\-]{0,62}$ (required)
properties Properties of a database. DatabaseProperties
type The resource type 'Microsoft.DBforPostgreSQL/flexibleServers/databases'

DatabaseProperties

Name Description Value
charset Character set of the database. string

Constraints:
Pattern = ^[a-zA-Z]+\w*$
collation Collation of the database. string

Constraints:
Pattern = ^[a-zA-Z\-]+([. ]|\w)*$

Usage Examples

Terraform (AzAPI provider) resource definition

The flexibleServers/databases 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/databases resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DBforPostgreSQL/flexibleServers/databases@2026-01-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      charset = "string"
      collation = "string"
    }
  }
}

Property Values

Microsoft.DBforPostgreSQL/flexibleServers/databases

Name Description Value
name The resource name string

Constraints:
Min length = 1
Max length = 63
Pattern = ^[a-zA-Z_][\w\-]{0,62}$ (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 database. DatabaseProperties
type The resource type "Microsoft.DBforPostgreSQL/flexibleServers/databases@2026-01-01-preview"

DatabaseProperties

Name Description Value
charset Character set of the database. string

Constraints:
Pattern = ^[a-zA-Z]+\w*$
collation Collation of the database. string

Constraints:
Pattern = ^[a-zA-Z\-]+([. ]|\w)*$

Usage Examples

Terraform Samples

A basic example of deploying PostgreSQL Flexible Server Database.

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" "database" {
  type      = "Microsoft.DBforPostgreSQL/flexibleServers/databases@2022-12-01"
  parent_id = azapi_resource.flexibleServer.id
  name      = var.resource_name
  body = {
    properties = {
      charset   = "UTF8"
      collation = "en_US.UTF8"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}