The PostgreSQL module contains two builders - postgreSQL, used to create PostgreSQL Azure servers, and postgreSQLDb, used to create individual databases. It supports features such as firewall, autogrow and version selection. Every PostgreSQL Azure server you create will automatically create a SecureString parameter for the admin account password.

  • PostgreSQL server (Microsoft.DBforPostgreSQL/servers)

PostgreSQL Builder keywords

Applies ToKeywordPurpose
Servername (string)Sets the name of the PostgreSQL server.
Serveradmin_username (string)Sets the admin username of the server.
Servergeo_redundant_backup (bool)Enables/disables geo-redundant backup
Serverenable_geo_redundant_backupEnables geo-redundant backup
Serverdisable_geo_redundant_backupDisables geo-redundant backup
Serverstorage_autogrow (bool)Enables/disables auto-grow storage
Serverenable_storage_autogrowEnables auto-grow storage
Serverdisable_storage_autogrowDisables auto-grow storage
Serverstorage_size (int<Gb>)Sets the initial size of the storage available
Serverbackup_retention (int<Days>)Sets the number of days to keep backups
Serverserver_version (Version)Selects the PostgreSQL version of the server
Servercapacity (int<VCores>)Sets the number of cores for the server
Servertier (Sku)Sets the service tier of the server
Serveradd_database (database:Database)Adds a database from the result of a postgreSQLDb builder expression
Serveradd_database (name:string)Adds a database with name of name
Serverenable_azure_firewallEnables firewall access to all Azure services
Serveradd_firewall_rule (name:string, start ip:string, end ip:string)Adds a firewall rule to the server
Serveradd_firewall_rules (rules:(stringstringsting)list)As add_firewall_rule but a list of rules
Serveradd_vnet_rule (name:string, virtualNetworkSubnetId:ResourceId)Adds a vnet rule to the server
Serveradd_vnet_rules (rules:(string*ResourceId)list)As add_vnet_rule but a list of rules
Configuration Members
FullyQualifiedDomainNameThe fully qualified domain name for the server endpoint.

PostgreSQLDb Builder keywords

Applies ToKeywordPurpose
Databasename (string)Sets the name of the PostgreSQL database
Databasecollation (string)Sets the collation of the postgreSQL database
Databasecharset (string)Sets the charset of the postgreSQL database


open Farmer
open Farmer.Builders
open Farmer.PostgreSQL

let myPostgres = postgreSQL {
    admin_username "adminallthethings"
    name "aserverformultitudes42"
    capacity 4<VCores>
    storage_size 50<Gb>
    tier GeneralPurpose
    add_database "my_db"

let template = arm {
    location Location.NorthEurope
    add_resource myPostgres
    output "fqdn" myPostgres.FullyQualifiedDomainName

// since there is currently no free tier for PostgreSQL, actually deploying this
// *will* incur spending on your subscription.
|> Write.quickWrite "postgres-example"