azure-templatesapache-airflow

Connect to the Azure Database service

You can connect to the Azure Database for PostgreSQL from the primary virtual machine. Follow the steps below:

  • Log in to the Microsoft Azure portal.
  • Select the “Resource groups” menu item and then select the resource group containing the Azure Database for PostgreSQL instance.
  • Select the Azure Database for PostgreSQL instance.
  • Obtain the hostname and username for the Azure Database for PostgreSQL instance from the “Overview” page, as shown below:

    Host information

  • Log in to the server console via SSH.

  • Use the psql command-line tool to connect to the Azure Database for PostgreSQL, as shown below. Replace the HOSTNAME and USERNAME placeholders with the actual hostname and username for the Azure Database for PostgreSQL instance:

    $ psql "host=HOSTNAME dbname=postgres user=USERNAME port=5432 sslmode=require"
    

    You will be prompted to enter a password. This is the same password you configured when deploying the Multi-Tier Solution.

You can also connect to the Azure Database for PostgreSQL instance from your own local system, as long as it has the client side command-line tool installed. By default, the Azure Database for PostgreSQL instance will deny connections from other hosts. Therefore, in this case, you must additionally add your local host’s IP address to the whitelist of allowed hosts using the “Settings -> Connection security” page of your Azure Database for PostgreSQL instance, as shown below:

Firewall rule

Last modification February 21, 2019