Az.PostgreSqlServer Overview
The Az.PostgreSql PowerShell module provides cmdlets for managing Azure Database for PostgreSQL servers. This reference details the Az.PostgreSqlServer cmdlets, their parameters, examples, and best practices.
Cmdlets
Examples
Example 1: Get all PostgreSQL servers in a subscription
Get-AzPostgreSqlServer
Copy
Example 2: Create a new PostgreSQL server
New-AzPostgreSqlServer -Name "mypgserver" -ResourceGroup "MyRG" -Location "EastUS" -AdministratorLogin "pgadmin" -AdministratorLoginPassword (ConvertTo-SecureString "P@ssw0rd!" -AsPlainText -Force) -SkuName "GP_Gen5_2"
Copy
Example 3: Update the server's backup retention period
Set-AzPostgreSqlServer -Name "mypgserver" -ResourceGroup "MyRG" -BackupRetentionDays 14
Copy
Common Parameters
Parameter Type Description
-Name String Name of the PostgreSQL server.
-ResourceGroup String Resource group containing the server.
-Location String Azure region where the server will be provisioned.
-AdministratorLogin String Administrator username.
-AdministratorLoginPassword SecureString Administrator password.
-SkuName String Pricing tier (e.g., GP_Gen5_2).
-BackupRetentionDays Int Number of days to retain backups (7‑35).
-Force Switch Suppresses confirmation prompts.