App service Connecting to Cosmos DB with Multiregion enabled + Failover

Mathew James 421 Reputation points
2024-02-29T07:40:46.2533333+00:00

Hi Everyone - I have a doubt on Connectivity for Cosmos db for our BCDR set up. Let me explain. Our Aim is to have a BCDR for our application hosted in West US2 (primary region) and also in East US2 (Secondary region) and both in Active-Active mode.

  1. Our Primary Region West US2:- We have App services fetching the connection string from Key Vault to connect to our Cosmos db.
    Note:- Cosmos DB has Multi region enabled (Single region write) and the secondary region for Cosmos has been configured as East US2.
  2. Our Secondary Region East US2 :- We have Configured another region for our BCDR which is in East US2 where in we have our App services and Key Vault. (no Cosmos DB has been configured here) Here are my Concerns :-
  3. I believe in both the Key Vaults in primary & Secondary Region the connection string to Cosmos will be one and the same. - which means both pointing to the One single Cosmos db hosted in Primary region West US2. Is this a fair assumption ?
  4. Or in other words, In Primary Region (west us2) App Service 1 --> Key Vault 1 --> Cosmos DB 1 in Primary region (west US2)
  5. In Secondary region (east us2)
    App Service 2 --> Key Vault 2 --> Cosmos DB 1 in Primary region (west US2)

If we do the above Configuration, If the Primary region fails - It will switch to Secondary region and App service 2 will point to Cosmos 1 and since Whole region has failed, App service 2 in secondary region will automatically connected to Cosmos 1 in East US2 as multiregion is enabled already.

Is this the correct way of implementing BCDR for applications dealing with Cosmos db database ?

Appreciate your thoughts & help.

Thanks!
-Mathew James

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,639 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,784 questions
0 comments No comments
{count} votes

Accepted answer
  1. GeethaThatipatri-MSFT 29,392 Reputation points Microsoft Employee
    2024-02-29T17:11:56.54+00:00

    Hi, @Mathew James Welcome to Microsoft Q&A thanks for posting your question.

    For this configuration (WUS2 – write, EUS2- read), it is recommended that the account enables service-managed failover. This will allow the service to fail over to available regions. Without this, the account will occur loss of write availability for the region outage. More details are provided here https://learn.microsoft.com/en-us/azure/cosmos-db/high-availability#availability

    Please let me know if you have any additional questions.

    Regards

    Geetha


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.