Hi Brayan Riveros ,
Thank you for reaching out to Microsoft Q&A.
“Dropping” can mean two different things in Azure Database for PostgreSQL – Flexible Server. The fix depends on whether the database inside the server is stuck, or the entire server resource is stuck. Try the matching section below.
- If a database is stuck in “Dropping” This usually happens because sessions are still connected.
Steps (safe):
- Block new connections and terminate existing ones.
ALTER DATABASE mydb CONNECTION LIMIT 0;
REVOKE CONNECT ON DATABASE mydb FROM PUBLIC;
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'mydb' AND pid <> pg_backend_pid();
- Drop it with force (PG 13+):
DROP DATABASE IF EXISTS mydb WITH (FORCE);
- Confirm it’s gone:
SELECT 1 FROM pg_database WHERE datname = 'mydb';
If apps keep reconnecting, briefly stop them (firewall/NSG) or restart the server, then repeat step 1 and 2.
- If the server resource is stuck in “Deleting/Dropping” Do these quick checks in the Azure portal: • Resource group → Locks: remove any Delete lock. • Server → Networking → Private endpoint connections: remove/detach any that still point to this server. • Replication: delete read replicas first (you can’t delete a primary while replicas exist). • Activity log: open the last Delete/Update entry and note the Operation/Correlation ID and any error.
Then try a command-line delete by resource ID:
# Get the resource ID
az postgres flexible-server show -g <rg> -n <server> --query id -o tsv
# Delete using the resource ID
az resource delete --ids "<resource-id>"
If it still shows Dropping after these steps, please share required detail in private message