---
title: "Azure Database for PostgreSQL"
description: "Connect an agent-native app to Azure Database for PostgreSQL with a standard DATABASE_URL."
search: "Azure Database PostgreSQL Flexible Server connection string firewall SSL migrations"
---

# Azure Database for PostgreSQL

Azure Database for PostgreSQL is a managed PostgreSQL service. Flexible Server
uses the normal PostgreSQL protocol, so the app can use its server hostname in
`DATABASE_URL`.

## Configure the app

Create an application database and user, then copy the server hostname from
the Azure portal. Set `DATABASE_URL` in the server environment:

```bash
DATABASE_URL=postgresql://app_user:password@my-server.postgres.database.azure.com:5432/appdb?sslmode=require
```

Use an application user instead of the server administrator when possible.
Keep the credentials in your deployment's secret storage, and URL-encode
special characters in the username or password when needed.

## Networking and TLS

Configure the server firewall or private network so the deployed app can reach
the PostgreSQL hostname. Azure Database for PostgreSQL requires encrypted
connections by default. Keep `sslmode=require` in the connection URL unless
your approved network and server configuration require a stricter TLS mode.

## Migrations

Run production migrations in the release or deployment step. The migration
runner must use a network path that can reach the Azure server. Never run
`drizzle-kit push` against a production database.

## What's next

- [Database](/docs/server-database) - schema, migrations, and connection rules
- [Deployment](/docs/deployment) - choose a runtime and deployment preset
- [Azure Database for PostgreSQL connection docs](https://learn.microsoft.com/en-us/azure/postgresql/overview) - configure the server and networking
