# Step 1: Deploy the primary and replica databases

The setup instructions are based on a [architecture-example](https://docs.sonarsource.com/sonarqube-server/2025.4/server-installation/data-center-edition/on-kubernetes-or-openshift/setting-up-disaster-recovery/architecture-example "mention").

Deploy the primary and replica PostgreSQL databases on Azure as follows:

1. On the Azure Database for PostgreSQL flexible server creation page of your primary database, select your subscription and resource group.
2. In **Server details** > **Compute + storage**, select **Configure server**. A new pane opens.

<div align="left"><figure><img src="https://512221655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyDv2XwTC1xoOKBYeCK45%2Fuploads%2Fgit-blob-0b0b14d9308cf764badbec521b32dbc16b6453da%2Fsonarqube-dce-disaster-recovery-configure-azure-database.png?alt=media" alt="In the Server details of your primary Azure database, select Configure server"><figcaption></figcaption></figure></div>

3. In **Backups**, enable the **Geo-redundancy**.

<div align="left"><figure><img src="https://512221655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyDv2XwTC1xoOKBYeCK45%2Fuploads%2Fgit-blob-0b7acc9dc53a44cb2fa7f5cf1a149a00894a571f%2Fsonarqube-dce-disaster-recovery-azure%20database-enable-geo-redundancy.png?alt=media" alt="Enable the geo-redundancy by selecting the Recover from regional outage or disaster option"><figcaption></figcaption></figure></div>

4. Once the primary database has been deployed, create the replica database. To do so, go to the primary database resource page > **Settings >** **Replication >** **Create replica**. Ensure that you select a different **Availability zone** than for the primary database.

<div align="left"><figure><img src="https://512221655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyDv2XwTC1xoOKBYeCK45%2Fuploads%2Fgit-blob-aae48249dd31fde28ea7c470fc6393bbad18572f%2Fsonarqube-dce-disaster-recovery-azure-replica-database-availability-zone.png?alt=media" alt="Create the replica database and set a different Availability zone that for the primary database"><figcaption></figcaption></figure></div>

5. Create virtual endpoints: go to **Database Settings** > **Replication** > **Virtual endpoints**.

<figure><img src="https://512221655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyDv2XwTC1xoOKBYeCK45%2Fuploads%2Fgit-blob-ae5408466ccae9e4083c81a9d6ec6db5c65d934f%2Fsonarqube-dce-disaster-recovery-azure-front-door-endpoints-command.png?alt=media" alt=""><figcaption></figcaption></figure>

The following pane is displayed.

<div align="left"><figure><img src="https://512221655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyDv2XwTC1xoOKBYeCK45%2Fuploads%2Fgit-blob-cb41ef30301beb8caa7695b821170cef26d326ac%2Fsonarqube-dce-disaster-recovery-azure-front-door-create-virtual-endpoints.png?alt=media" alt=""><figcaption></figcaption></figure></div>

## Related pages <a href="#related-pages" id="related-pages"></a>

* [architecture-example](https://docs.sonarsource.com/sonarqube-server/2025.4/server-installation/data-center-edition/on-kubernetes-or-openshift/setting-up-disaster-recovery/architecture-example "mention")
* [set-up-clusters-on-aks](https://docs.sonarsource.com/sonarqube-server/2025.4/server-installation/data-center-edition/on-kubernetes-or-openshift/setting-up-disaster-recovery/set-up-clusters-on-aks "mention")
* [configure-azure-front-door](https://docs.sonarsource.com/sonarqube-server/2025.4/server-installation/data-center-edition/on-kubernetes-or-openshift/setting-up-disaster-recovery/configure-azure-front-door "mention")
* [test-failover-scenarios](https://docs.sonarsource.com/sonarqube-server/2025.4/server-installation/data-center-edition/on-kubernetes-or-openshift/setting-up-disaster-recovery/test-failover-scenarios "mention")
