Freigeben über


Auto grow Azure Database for PostgreSQL storage using PowerShell

APPLIES TO: Azure Database for PostgreSQL - Single Server

Important

Azure Database for PostgreSQL - Single Server is on the retirement path. We strongly recommend that you upgrade to Azure Database for PostgreSQL - Flexible Server. For more information about migrating to Azure Database for PostgreSQL - Flexible Server, see What's happening to Azure Database for PostgreSQL Single Server?.

This article describes how you can use PowerShell to configure Azure Database for PostgreSQL server storage to scale up automatically without impacting the workload.

Storage auto grow prevents your server from reaching the storage limit and becoming read-only. For servers with 100 GB or less of provisioned storage, the size increases by 5 GB when the free space is below 10%. For servers with more than 100 GB of provisioned storage, the size increases by 5% when the free space is below 10 GB. Maximum storage limits apply as specified in the storage section of the Azure Database for PostgreSQL pricing tiers.

Important

Remember that storage can only be scaled up, not down.

Prerequisites

To complete this how-to guide, you need:

If you choose to use PowerShell locally, connect to your Azure account using the Connect-AzAccount cmdlet.

Enable PostgreSQL server storage auto grow

Enable auto grow storage on an existing server with the following command:

Update-AzPostgreSqlServer -Name mydemoserver -ResourceGroupName myresourcegroup -StorageAutogrow Enabled

Enable auto grow storage while creating a new server with the following command:

$Password = Read-Host -Prompt 'Please enter your password' -AsSecureString
New-AzPostgreSqlServer -Name mydemoserver -ResourceGroupName myresourcegroup -Sku GP_Gen5_2 -StorageAutogrow Enabled -Location westus -AdministratorUsername myadmin -AdministratorLoginPassword $Password

Next steps