How to configure a custom domain for a containerized web app? - azure

I'd like to consider this Azure feature:
https://www.youtube.com/watch?v=HxXs9_ggBfg
But it won't be of much use to me if I'm unable to configure a custom domain for it. I'm having no problem with custom domains for standard App Service websites, but this is for containers.
I've tried searching for documentation, but I'm coming up empty.
--EDIT--
The technology I'm interested in is Web Apps for Containers; thanks to #sam-cogan for pointing this out to me.

I believe the video is talking about Azure Web Apps for Containers (I would really recommend not asking people to watch a 30-minute video to understand your question). Assuming that is the case, then adding a custom domain name is the same as setting one up for a normal app service, you can do so through the custom domain name settings in the portal. The process is documented here.
If you're looking to use a different service in Azure for hosting containers then please state which one and I will update. All of these can have custom domain names.

Azure Container Instances usually provide a public IP address, so pointing a domain name to it should not be a problem.
You could map either an A record or a CNAME to your instance.

There is no difference between configuring custom domain for normal web apps and web for container. I have tried below document and it is worked well.
http://www.ayushrathi.com/configuring-a-custom-domain-name-for-web-app-azure-portal/

Related

One CNAME for two Azure Web Apps

can I use one CNAME record for two Azure Web App without a third-party service or services Azure? For example, so that I call testcname1.com/api in the code and the traffic goes for example to the web app test-api, and if I use testcname1.com/indentity the traffic goes to the web app test-indentity. Two Web Apps test-indentity and test-api one CNAME testcname1.com. Thanks.
On a pure DNS level, you can't point a CNAME entry to two different other adresses.
Azure Application Gateway is designed to do exactly what you want, but if I understand you correctly, you don't want to use other services.
As an alternative, you could set up a third AppService and host a reverse proxy, e.g. ngnix using WebApp for Containers. Or use IIS features directly, e.g. like this.
As Lex Li pointed out, you could also use one of your existing app services as a reverse proxy in addition to what it is already doing. Depends on how strongly you want to couple your services. Personally, I would probably use a dedicated instance just as a proxy, but both approaches can be valid.
Azure Traffic Manager does exactly what you want I think.
It is not free but for light/moderate load should be (very) cheap.
Does health checks as well.
from https://azure.microsoft.com/en-in/pricing/details/traffic-manager/
- $0.54 per million queries
- $0.36 per Azure endpoint/month

Subdomain Azure WebApp

This is more of a general question about. I have a website running as an Azure App Service. I configured a custom domain so that you are able to call it by my-site-name.com.
As the request of customers kept growing and each customer has specific demands, I was wondering if it is possible to have a subdomain for each customer. For example, client1.my-site-name.com and client2.my-site-name.com.
Is it possible to do all of this within a single App Service or do I need to set up an Azure App Service for each subdomain?
The reason behind my question is, that it would be quite expensive to have an App Service for each individual customer.
You should also consider just adding a wildcard custom domain entry. This is an older blog post, but it outlines Azure WebApp support for Wildcards:
https://azure.microsoft.com/en-us/blog/azure-websites-and-wildcard-domains/
This would mean that *.my-site-name.com traffic goes to your single Web App. Then it is up to the logic of your webapp to determine which client it is by inspecting the hostname of the request (client1.my-site.name.com) and taking the appropriate action to customize the response to that client.
Using a wildcard eliminates the need to add a specific custom subdomain mapping for each client.
It should be possible. Within your app service, if you go to the settings for that service, there is a Custom domains option, select it.
Within there you can then map your subdomains to this service, and it allows you to do it multiple times. You just need to validate and set it up with the A record or CNAME and own the domain. Additionally, you should be able to add SSL Bindings for each.
Here are some documentation on it, I don't believe this documentation handles your exact use case but it does touch on the custom domain portion and should provide additional support.
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain
https://blogs.msdn.microsoft.com/waws/2014/10/01/mapping-a-custom-subdomain-to-an-azure-website/
Let me know if you need more
This seems more like a domain management issue than an azure specific issue. You have already decided to have different sub domains to each customer. That, by definition, means each sub domain needs individual server space. That in turn would mean, an app service for each customer.
So, the answer is what you already have. Have an app service (essentially web server) for each customer via sub domain.
In your position, I would consider some alternatives.
Rebuild your app to work with some form of login system, so clients login and get themselves a separate view.
Alternatively, go with sub folders instead of custom domains. something like, domain.com/client1, domain.com/client2 and so on.

azurewebsites.net was already mapped, but still apears

I followed exactly the description by Microsoft to map their web apps on one's own external domain. And the redirection is even correct.
But my purpose was to map mydaylivery.com to the mydayliveryop.azurewebsites.net, so that the mydayliveryop.azurewebsites.net is replaced by my mydaylivery.com domain. However, there is just a redirection, but no replacement.
In my azure portal under the web app dashboard and beside "URL" is also mydaylivery.com mentioned. But if you go on mydaylivery.com, you see that there is still the azurewebsites.net subdomain.
I have used dig web interface to check your dns. It seems that you don't configure the domain correctly. The article you provide is suitable for Azure cloud service not Azure web App. I would suggest you have a look at this article. Please note below part in the article:
To use an A record to map to your Azure app's IP address, you actually need to create both an A record and a TXT record.

Allowing Users to Enter a Custom cname on Azure Websites

I have a multi-site application running on Azure Websites. When a user signs up, they pick a name for their application and they end up with "appname.coolapplication.com". Everything so far is working great within our own domain.
Our application needs to allow users to enter their own custom domain. For example, they want to view their application from "elsewhere.com" rather than "appname.coolapplication.com". How do I go about configuring Azure Websites to allow me to do this?
You don't. Per these instructions you instruct the customer to enter a CNAME record on their domain registrar for the Azure domain, and then it begins to work.
EDIT:
The CNAME only "just works" for Azure Cloud Apps. For Azure Websites, it turns out you must add the domain in the portal as well. I'd thus recommend switching your Azure Websites to Azure Cloud Apps to simplify the issue.
You can use the powershell api to add custom hostnames.
See this question for details: Add many domains to an azure web site

How do you get an existing domain you own to point to Azure's servers?

By default, the naming conventions of Azure websites/webapps are somesubdomain.cloudapp.net and somesubdomain.azurewebsites.net. If I have an existing website that I have currently hosted through, say GoDaddy, and the website is www.mysite.com, how can I tell the registrar (DNS) to look at Azure's servers for the website content (I have experience in changing the nameservers to point to a particular web hosting company's nameservers, but it appears that there isn't a such thing with Azure).
Ultimately what I want to do is go to www.mysite.com and have the content hosted on Azure, running on Azure's VMs. Is the only way to mess with the CNAME, A, etc. properties of the DNS?
I have a VM on Azure that I want to use to host my websites. This is the platform that I will be using. I'm not using an Azure "website" or a "cloud service".
Yes, the only way to get this working as you describe it is to fiddle with the DNS, with a CNAME and A records.
A good description of how this is done can be found here:
http://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns/
There is an official documentation, relatively easy to find with a simple internet search:
How to use custom domain with Cloud Service and Storage Account
How to use custom domain with Azure Web Sites
EDIT
One thing good to remember is that a Windows Azure Virtual Machine (IaaS) runs in a Cloud Service. Meaning that for each VM, or set of VMs you have a cloud service created (i.e. mywhateverVM.cloudapp.net). This cloud service is implicitly created when you use the portal wizard to create the VM. Or explicitly (you create it) when you create VMs with PowerShell.
So the "How to use custom domain with Cloud Service" applies also for the Azure VMs with no change at all.

Resources