Reputation: 87
I have two Azure web apps:
webapp1 is my live website, which is configured with a custom domain, www.example.com.
I want to divert all incoming traffic so that it goes to webapp2, rather than webapp1.
My plan to do this was:
However, this approach doesn't work; When I try to add the custom domain name to webapp2 using portal.azure.com, I get the error: 'The host name www.example.com' is already assigned to another Azure website'.
It's important to ensure that there is no downtime in this transition, so removing the custom domain name from webapp1 before adding it to webapp2 isn't an option.
Any ideas on how I can solve this problem?
Upvotes: 3
Views: 459
Reputation: 1178
As per the previous answer, you can use Azure Traffic Manager to control traffic between Web Apps. However, you will still face the problem of registering the custom domain name against both web apps. The Traffic Manager documentation contains further information about how to do this - see "Can I use Traffic Manager with more than one Web App in the same region?" in the FAQ section here.
The key point is that if the Web Apps are in the same region, then they need to be in different scale units. The instructions linked above show how to check which scale unit your Web App is in. You can't control the scale unit when deploying the Web App, but if you submit a Support ticket you may be able to have your Web Apps deployed to different scale units by Azure Support.
Upvotes: 3
Reputation: 805
One potential way may be to configure a traffic manager. You could create a traffic manager and add webapp1 and webapp2 as end points. You could also configure the traffic manager to use failover routing with webapp1 being the primary and webapp2 being the failover.
Then you cloud change the custom domain to point at the traffic manager so that traffic continues to flow to the site through the traffic manager. That hopefully would allow you to remove the custom domain from webapp1 config and then configure webapp2 to use it. You could then change the custom domain to point at webapp2 and remove the traffic manager.
Alternately you can leave the traffic manager in place and just remove webapp1 as an endpoint.
I haven't tested this approach yet but if I get a chance to I'll update this answer with any notes.
Upvotes: 1