question

rwb196884 avatar image
0 Votes"
rwb196884 asked brtrach-MSFT edited

Using different subdomains of the same domain for different Azure App Services

I have an ASP.NET Core MVC app with the identity model extended to support multiple tenants. The application serves on a subdomain for each tenant.

I have a domain, foo.co.uk say.

I have set up the production environment so that <tenant>.foo.co.uk serves the tenant website.

Now I want to set up some test environments for which I have registered foo-test.co.uk and I want to deploy multiple test environments -- each as an App Service on a corresponding subdomain so that the tenant now becomes a sub-subdomain. For example:
<tenant>.test-a.foo-test.co.uk and
<tenant>.test-b.foo-test.co.uk.

I've tried a number of different permutations of DNS configuration for the Custom Domains of the Azure App Services -- some using A records and some using CNAME records. But I can't get anything to work.

Is this even possible?
If so then how?

I notice that both App Services have the same IP address, but an A record for * pointing at that address gives the blue Azure 404 page on some (but not all) subdomains and sub-subdomains.

azure-webapps-custom-domains
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, @rwb196884

How did you set up your custom domain? Can you share the procedure? I may be able to give you some advice.

0 Votes 0 ·

App Service -> Custom domains

Type in *.test-a.foo.co.uk and click validate.

In DNS add a TXT record with name ausid.test-a and value the given Custom Domain Verification ID.
In DNS add a CNAME record with name test-a and value as given: my-app.azurewebsites.net.

Alternatively, instead of the CNAME, an A record with name * and value the given IP address also does not work.

0 Votes 0 ·

1 Answer

brtrach-MSFT avatar image
0 Votes"
brtrach-MSFT answered brtrach-MSFT edited

@rwb196884 Was going through the April threads and saw that this never received a conclusive answer regarding using different subdomains on different app services.

I created brtrachdomaintestdelete.azurewebsites.net and added the custom subdomain a.test-a.beesphotos.net to it. Used a cname value brtrachdomaintestdelete.azurewebsites.net with a name of a.test-a.

I then created a second web app in a different resource group but in the same region called brtrachtest.azurewebsites.net and added the subdomain domain b.test-b.beesphotos.net. Used a cname value of brtrachtest.azurewebsites.net with a name of b.test-b.

It's important to note that I have three domain verification txt records on beesphotos.net.

  1. asuid

  2. asuid.atest-a

  3. asuid.btest-b

Each above txt record uses the same domain verification ID, which you can read more about here. Also, Microsoft recommends the use of CNAMEs when possible as it removes the issue of your A record IP address changing and bringing down your site. This would be extremely rare to happen but just wanted to share this tip with you that CNAMEs are the safer choice.

You can use digwebinterface.com on my above domains and compare/contrast with what you have, which if you are unfamiliar, allows you to see the DNS records for a domain. Note: my domains should be active for the next 72 hours before being deleted.

My domain was purchased in Azure and not a 3rd party provider if that also helps although I do not believe this should make a difference unless your 3rd party hosting provider had an obscure limitation in place.

Lastly, DNS domain changes can take up to 30-45 minutes to sync across the DNS servers so ensure you are giving your configuration enough time to propagate out before changing it. 75% of the customer issues I have seen over the last 8 years have been due to not enough time being given for propagation.

I hope the above example helps to reassure you that this is possible along with providing you the ability to cross verify your settings. If you have further questions or concerns, please let us know.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.