0
votes

I've got an Azure Web App that's accessed at a sub-domain of my client's domain, configured with a CNAME DNS record and a hostname defined in the web app's Custom Domains blade.

There's now a second client interested in using the same system, and rather than either building a fully multi-tenant version of the system or having multiple instances of the app, I wondered whether it was possible to configure multiple hostnames in the Web App, each of which would use a database specific to that hostname, so the second client could have a subdomain pointing to the same instance of the app, but using a different database?

If this isn't possible, are there any other options?

Unfortunately part of the system is not authenticated, so I can't just get client-specific differences based on the user logged in, as I won't know who they are apart from the URL they used to access the system.

1

1 Answers

1
votes

I believe this is possible. Disclaimer: I've only read about this and haven't actually implemented a project with it. Someone correct me if I'm wrong.

Azure SQL allows you to have multiple databases in an elastic pool. There's several tools and frameworks that will allow you to shard clients across different databases, and there's tools such as the ShardMapManager that will take a key and give you a connection to the appropriate client's database. See more details here.

Since your clients aren't always authenticated, you could use the subdomain that they're connecting to as the shard key.