
In this article, we will discuss the quick steps to create a database in Azure Database for PostgreSQL flexible server.
Table of Contents
How to create a database in Azure Database for PostgreSQL flexible server
Follow the below steps to create the database.
- Log in to the Azure Portal.
- Navigate to the Azure Database for PostgreSQL flexible server that you have created. If you have not yet created one, you can create a flexible server for your Azure Database for PostgreSQL now.

3. Click on the Databases link from the left navigation and then click on the + Add button.

4. On the Create Database window, Provide a name for your Database and then click on the Save button to create the database.

5. Now, it will take a few seconds to create the Database and you will see a message that the database has been created successfully. To cross-check, click on the Databases link from the left navigation and you will see the newly created database.

Create a database in Azure Database for PostgreSQL flexible server using Azure CLI
You can also create the database using Azure CLI Follow the below steps.
- Navigate to the Azure Database for PostgreSQL flexible server and click on the Databases link from the left navigation and cross-check the available databases.
- Click on the Cloud Shell icon from the top right of the Azure Portal then choose the Bash option.

3. Run the below command and make sure to change the host and the username as per yours.
psql --host=tsinfops.postgres.database.azure.com --port=5432 --username=tsinfouser --dbname=postgres
After the modification you can copy paste the above coomand on the terminal and hit Enter. Now it will ask to enter password for user. Enter the Password and hit the enter key. You will get the below output.
bijay [ ~ ]$ psql --host=tsinfops.postgres.database.azure.com --port=5432 --username=tsinfouser --dbname=postgres
Password for user tsinfouser:
psql (14.5)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=>
4. Now Write the below command to create the database.
Create Database tsinfonew;
Press the enter key. You will get the output like below

Now to cross check , if the database is created or not, Navigate to the Azure Database for PostgreSQL flexible server –> Click on the Databases link from the left side and refresh the page then you will see the new database got created successfully.

You may also like following the below articles
Wrapping Up
In this article, we have discussed two simple approaches to create database in Azure Database for PostgreSQL flexible server. Thanks for reading this article !!!