PostgreSQL 16 on Ubuntu 24.04: remote access set up, per-VM password and TLS at first boot.
You get PostgreSQL 16 from the PostgreSQL Global Development Group (PGDG) repository on Ubuntu 24.04 LTS, set up as a network database server. At first boot the VM generates its own password for the postgres superuser and its own TLS certificate, and proves both work before setup is marked complete.
Who it's for
- Developers and DBAs who want a PostgreSQL server with full control over configuration and extensions
- Application teams that need a relational database inside their own Azure virtual network
- Teams replacing a hand-built PostgreSQL VM
What's included
- PostgreSQL 16 server and client from PGDG, running as a systemd service (starts automatically with the VM)
- Remote access already configured: the server listens on all network interfaces, and pg_hba.conf (PostgreSQL's client access rules) accepts remote logins from any IPv4 or IPv6 address only over TLS and only with SCRAM-SHA-256 (a password check that never sends the password itself); unencrypted remote connections are refused
- TLS on (encrypted connections) with a self-signed certificate created on your VM at first boot, never shared between VMs
- Host firewall (ufw) that allows only SSH and port 5432
After you deploy
- Sign in over SSH. The generated postgres password is in a root-only file; sudo cat /etc/motd shows how to read it.
- Connect with psql or any client on port 5432 using sslmode=require; a remote connection without TLS is refused. The certificate is self-signed; for sslmode=verify-full, install a CA-issued certificate.
- Create your application role and database; sudo -u postgres psql works locally without the password.
- Important: the image accepts TLS-encrypted password logins from any address, so your Azure network security group (NSG) is what limits who can reach port 5432. Allow 5432 only from your application subnets.
- For production, narrow pg_hba.conf's hostssl rules to your subnets, change the password and delete the file.
Why this image
- Unique superuser password and TLS key on every VM; none are baked into the image
- Before setup is marked complete, first boot signs in over TLS with SCRAM on the VM's own IPv4 and IPv6 addresses and proves that an unencrypted connection there is refused
- Saves the manual work of adding the PGDG repository, opening remote access and creating a per-VM certificate
- Ubuntu updates applied when each image version is built
How it runs on Azure
A virtual machine in your own subscription and virtual network (VNet), so your data stays on disks you control. The software charge is pay-as-you-go on your Azure invoice, alongside compute and storage. Recommended size: Standard_D2as_v5 or larger.
License and support: PostgreSQL is open-source software under the PostgreSQL License. Packaged by Derek Coleman & Associates Inc; not affiliated with or endorsed by the PostgreSQL Global Development Group. Get started with the setup guide at www.dcassociatesgroup.com/support