Hello Yash !
Thank you for posting on Microsoft Learn.
Azure mandates that a replica must match the configuration of its primary (compute/storage) to be promotable to primary. This prevents blue/green promotion with config changes on the replica.
Also don't forget that server names/hostnames are immutable, and promotion to standalone results in a new FQDN can require app reconfiguration.
You can’t directly achieve blue/green inside Azure PostgreSQL Flexible Server, but you can orchestrate it externally.
How ?
You can use a Client-Agnostic connection endpoint (proxy or DNS indirection).
So you need to place a PgBouncer instance (or HAProxy/Nginx with stream module) in Azure (VM, container, or App Service).
In this way, the clients connect to PgBouncer using a custom DNS name and then it routes traffic to either the blue (current) or green (new) PostgreSQL server.
Don't forget that :
- You can’t promote a read replica with a different compute config
- You can’t rename PostgreSQL servers in Azure
- You can’t clone or swap the primary/replica roles like traditional on-prem setups