Create an Azure Database for PostgreSQL server
This tutorial guides you through the process of creating a new Azure Database for PostgreSQL server using the Azure portal. You'll learn how to configure essential settings and understand the options available during server creation.
Prerequisites
- An Azure account with an active subscription. If you don't have one, create a free account.
- (Optional) Azure CLI installed locally, or you can use the Azure Cloud Shell.
Steps to Create a Server
Step 1: Navigate to the Azure Portal
Sign in to the Azure portal.
In the search bar at the top, type Azure Database for PostgreSQL servers and select it from the search results.
Step 2: Initiate Server Creation
On the Azure Database for PostgreSQL servers page, click + Create.
This will open the server creation form.
Step 3: Configure Basic Settings
Fill out the following fields on the Basics tab:
- Subscription: Select your Azure subscription.
- Resource group: Create a new resource group or select an existing one. A resource group is a logical container for your Azure resources.
- Server name: Enter a unique name for your PostgreSQL server. This name must be globally unique across all of Azure.
- Region: Select the Azure region where you want to deploy your server. Choose a region close to your users or applications for lower latency.
- Version: Select the PostgreSQL version. Common choices include 10, 11, 12, and 13.
- Compute + storage: Click this to configure your server's performance tier and storage.
- Administrator username: Enter the administrator login name for the server (e.g.,
pgadmin
). This username cannot be the same as the service name (e.g.,azure
,postgres
,admin
,user
,root
,guest
,public
,system
). - Password: Enter a strong password for the administrator account and confirm it.
Step 4: Configure Compute and Storage
Clicking Compute + storage will open a new pane where you can select:
- Pricing tier: Choose between General Purpose, Memory Optimized, or Basic.
- vCore: Select the number of virtual cores.
- Storage: Choose the amount of storage needed.
- Backup retention period: Set how long backups are retained (e.g., 7 to 35 days).
After configuring, click Apply.
Step 5: Configure Networking
Navigate to the Networking tab.
Here you can configure how your server is accessed:
- Connectivity method: Choose between Public access (allowed IP addresses) or Private access (VNet Integration). For initial testing, Public access is usually sufficient.
- Allow access to Azure services: Toggle this if you need other Azure services to connect to your server.
- Connection security: You can enable SSL enforcement if required.
Important Note: If you choose Public access, you will need to configure firewall rules later to allow specific IP addresses to connect to your server.
Step 6: Configure Additional Settings (Optional)
Go to the Additional settings tab.
You can specify:
- Backup options: Further customization of backup storage redundancy.
- High availability: Enable zone-redundant HA for increased resilience.
- Tags: Apply tags for better resource organization and billing management.
Step 7: Review and Create
Click the Review + create tab.
Azure will validate your configuration. If validation passes, you'll see a summary of your server's settings.
Carefully review all the details. Once you are satisfied, click the Create button.
After successful deployment, your new Azure Database for PostgreSQL server will be listed in the Azure portal. You can then proceed to connect to it and start creating your databases.
Using Azure CLI to Create a Server (Example)
You can also create a server using the Azure CLI. Replace the placeholder values with your own.
az postgres server create \
--resource-group <your-resource-group-name> \
--name <your-server-name> \
--location <your-region> \
--admin-user <your-admin-username> \
--admin-password <your-admin-password> \
--sku-name Standard_D2s_v3 \
--tier GeneralPurpose \
--storage-size 128 \
--version 13 \
--backup-retention 7 \
--public-access 0.0.0.0
To learn more about Azure CLI commands for PostgreSQL, refer to the Azure CLI documentation.
Next Steps
Once your server is created, the next logical steps are:
- Configure firewall rules to allow specific IP addresses to connect.
- Connect to your server using a client tool or application.
- Create a database on your new server.