One CNAME for two Azure Web Apps - azure

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

Related

What to use for routing thousands of subdomains in Azure?

We have an application that we are hosting in multiple environments in Microsoft Azure. We want to route the traffic based on subdomains, like xxx.mydomain.com should go to the webapp that I have in North Europe and yyy.mydomain.com and zzz.mydomain.com should go to the webapp that I have in the East US.
I know it sounds like simple DNS, but it is more than that. Because:
I need to be able to add or update entries dynamically using code so an API should be available for that.
A normal DNS entry has a 24 hours time to live meaning that if I want to move my app from one environment to another, for up to 24 hours, users will hit both environments.
I expect to have hundreds of thousands of subdomains. Azure DNS has a limit of 25,000 entries.
I've looked into Azure Traffic Manager. It doesn't seem to have an option for traffic based on subdomains.
Also, I've looked at Azure Application Gateway. It seems to be the correct choice and it supports API's, but I cannot find the limits for subdomains.
Any suggestions?
From the criteria, it seems you're looking for a load-balancer/proxy/application-delivery-controller solution that's controllable through an API. I'll add my 5 cents here, as we've just gone through very similar problem. However these are more of a suggestion to look for answers elsewhere then Azure.
Azure
Azure Traffic Manager or Azure Application Gateway have limits which you can't fit in. For example in Azure Application Gateway with 200 rules, you could potentially host only 200 HTTPS site, the moment you need to serve HTTP & HTTPS, you're limited to 100 sites per application gateway. You'd need to split your solution across multiple subscriptions in order to fit subscription wide limits. Also the application gateway API is a bit too convoluted for my liking.
Azure DNS is also a bit problematic, as DNS records can last up to 24 hours. You'd therefore loose the ability to switch/route traffic to a different origin instantly.
Self-hosted
You could look into more old school solutions, run HAProxy or Nginx and programmatically modify their configuration(text files) on the fly and reload the configuration. HAPRoxy also has a socket "API" that can simplify the configuration modification and reload for you.
There's also a new set of service mesh controllers such as Kong, which can run in the cloud natively and are meant for service mesh solutions, however Kong offers a simple API, where you could manage/route traffic easily.
SaaS
If you're into buying this as a Service, Edge Cloud providers such as Cloudflare, Fastly or others are indeed "one big proxy server" and it is possible to configure them programmatically to route traffic to different origins, it's what they do after all.
Azure Application Gateway is indeed perhaps one of the best options for your scenario.
As you already said, it has an api that you could use to dynamically add rules based on your subdomains.
The limits for Application Gateway only allow for 200 rules per gateway.
But you can have 1000 gateways per subscription so if you could chain the gateways, that will give you roughly 200.000 rules.
The Microsoft documentation doesn't show that you can request an increase in these limits but maybe if you ask really nice the might allow it.
Maybe this is not the answer to your question but it might be an answer.
If anyone interested, we've ended up using Azure DNS. We have contacted Microsoft and they confirmed that they can increase the quota to 500,000 which is more than enough for us. :)

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

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/

Azure Traffic Manager for multiple web apps

Hello I have 3 different web app. Each web app has a different application with a different endpoint. I need to replicate all of these app services in multiples region. My question is. Do I need to have one Traffic manager for each replication application?
The other alternative that I had was. I could have one traffic manager in front of all applications, and Behind the traffic manager but ahead of the all application for integrating all app service in a one, I could have one API gateway. In that case, I suppose that I could have only one traffic manager instead of three.
Does somebody have one recommendation for this type of architecture?
Azure traffic manager is designed as a global service,not bound to a location. If you have 3 webapps located in different regions, use one traffic manager to route all requests will be ok. This reference architecture will be helpful: https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/app-service-web-app/multi-region

Host 2 separate sites, one domain, on one Azure site

I have a wordpress site hosted on Azure. Call it, mysite.com. I'd also like to develop a separate .net app and host it at subsite.mysite.com. How can I do this without having to pay for 2 separate Azure sites?
There are ways to achieve what you require. However, key point here is to understand the Azure App Service. Because, in Azure app service, you never pay (your concern is having to pay, not having to maintain) for a single site!
If you take a closer look at the App Service Pricing model, you will see that even with the free (like in Free lunch) tier, you get to host 10 applications in your hosting plan. But you need custom domain, then you go to Shared plan, you already can host 100 web sites within it, all with your custom domain/s.
Next you will have to learn a bit about what is Top Level Domain, what is Domain, what is Sub Domain, what is A DNS Record and what is C-Name DNS record, because these are all thing you need to understand in order to properly configure your sites.
And finally read the article on how to configure custom domain for Azure App Service.
Remember. With Azure App Service, you are paying for a hosting environment (or service plan), not for a single web site!

How to convert multiple web sites hosted on IIS to Azure web sites

I currently have a VPS with another provider. On that VPS, I have IIS running with multiple app pools and web sites. I would like to get out of the "server management business", so it would seem that Azure Web Sites (Reserved) would be a great fit. I'm able to get the Azure Web Sites set up, including the custom domain piece. The problem that I can't seem to figure out is how to get the same URLs and behavior that I currently have on my VPS.
For example, I have URLs that look like this right now:
www.foo.com/bar
www.foo.com/baz
wildcard.foo.com/bla
I can't find a way to mimic that in Azure.
Things I've thought of/tried:
Go with one Azure Web Site and have separate virtual directories/app pools in Azure, but googling tells me that isn't supported.
Create 3 Azure Web Sites, one for each of the above. The problem there as I see it is I would need to change to use bar.foo.com, baz.foo.com, and bla.foo.com/wildcard (i.e. lose wildcard subdomain mapping and rework things to have a custom route at the end).
Maybe have one Azure Web Site with a rewrite URL? The problem I think I'd run into there is that it all runs in one app pool, so deploying one piece will affect all 3, and obviously a fault in one app would impact the other 2.
Has anyone else gone down this path and solved it? If the answer is spin up a virtual server, I'll probably just stay where I'm at.
Considering www.foo.com/bar, www.foo.com/baz and wildcard.foo.com/bla are 3 independent web applications that share a domain (foo.com):
Create a Windows Azure Website for each web application. You don't necessarily need to assign custom domain names to them.
Create another, separate website and assign to it the *.foo.com domain using an A record. Refer to Configuring a custom domain name for a Windows Azure web site for instructions. As documented, "With an A record, you map a domain (e.g., contoso.com or www.contoso.com) or a wildcard domain (e.g., *.contoso.com) to the single public IP address of a deployment within a Windows Azure web site. The main benefit of this approach over using CNAMEs is that you can map root domains (e.g., contoso.com) and wildcard domains (e.g., *.contoso.com), in addition to subdomains (e.g., www.contoso.com)."
In this "master" website, set up URL redirection (possibly with status code 307 Temporary Redirect) so that requests go to the appropriate applications.
Alternatively, to avoid the delay of the additional request caused by the redirection, set up the "master" website as a reverse proxy that transparently forwards the request to the "inner" web application and sends the response back to the user.
As yet another alternative, use a custom DNS service to do the routing at the DNS layer.
This way, each web application is independent and you solve the issue of routing requests to the appropriate application.

Resources