Hi @Abhijit Mukherjee ,
Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.
I understand that you are trying to implement load balancing across regions for private traffic.
Currently, for cross-region, we only have Public connectivity/load-balancing.
- In your solution, I can see you will be using two DNS servers, each in one region.
- If that's the case, then I think you will end up having two distinct identical architectures in each region.
- You can modify the DNS A record of one region, establish VNet Peering, and connect to the other in case of regional failure.
- But this purely depends on your architecture and other requirements
Now, for your requirement, "Redirect users to the primary environment only and if its unavailable then to secondary"
To address your queries,
1) Session Affinity:
- Session Affinity is between the Application gateway and backend.
- Not between client and Application gateway(s)
- From the above setup, I can see you will have 2 App gateways
- So, I do not think Session Affinity can help here.
2) Round Robin in DNS servers.
- Per our discussion, I believe you will have 2 DNS servers, i,e, 2 Identical environments connected to each other.
- One idea I can suggest is to update the secondary DNS server's A record to only point to the Primary App gateway
- Should there be any outage in Primary, you can either run some script or manually update your DNS servers to point to the secondary App gateway
- However, if my understanding is incorrect, and you have only one DNS server, you can still use the same logic to edit the A record as per the availability.
Cheers,
Kapil
Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.