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

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!

Related

Azure SubDomain Link to Appservice

I have domain example.com I bought in azure.And I have two appservices app1 and app2.
I can link example.com to app1
But I want to link example.com/one to app1(appservices)
and example.com/two to app2(appservices).
Can anyone plz suugest me how to do this in Microsoft Azure
Using Azure Application Gateway and creating the relevant routing rules would be a good way to do this.
Here's a quick screenshot from Microsoft Docs which talks about a similar scenario..
Do know that there is price associated with it (and a lot of other features). So you may need to evaluate a bit.
Application Gateway Pricing
You will need to assign the custom domain to a load balancer. Azure App Gateway supports URL based routing. Since Azure App Services are multi-tenant you will need to follow these docs to configure App Gateway with an App Server. This is a great solution for single region applications.
If you need mutli-region support, check out our new Azure Front Door Service. Azure Front Door Service enables you to define, manage, and monitor the global routing for your web traffic by optimizing for best performance and instant global failover for high availability. With Front Door, you can transform your global (multi-region) consumer and enterprise applications into robust, high-performance personalized modern applications, APIs, and content that reach a global audience with Azure.

How to configure an SSL certificate only for the custom domain ( skip domains *.azurewebsites.net)

I have several (4) web apps running on Azure: 3 of them require very little processing power, thus, they had been running
on a Free plan; while the other one is meant for final users which means a higher load and a needs for a custom domain and SSL certificate.
SSL certificate was correctly configured (https://azure.microsoft.com/en-us/documentation/articles/web-sites-purchase-ssl-web-site/) and is working as expected.
However, we noticed all of the other sites are now importing this SSL certificate as opposed to the one offered by default by Azure (the one for *.azurewebsites.net sites);
this has caused all of our Free sites to move to the Basic tier automatically. We are the unable to set them to Free again, as an error message states Free does not support
our custom SSL certificate for our custom domain.
Notice that our custom domain is in no way associated with any of the (3) Free sites but just the one that needs it.
Also, when going to SSL cert options in our Free sites, we cannot remove the custom SSL cert, as it states the site requires at least one of them, and custom one is the only one.
When creating a new site, this custom SSL will be automatically imported as well.
What should we do so the Free sites make use of the default *.azurewebsites.net SSL cert instead of the custom one, so we can then get back these sites to the Free plan?
Thank you for your help.
1.Root cause: It maybe that use the same hosting plan for all your websites.
As free app service plan doesn’t support custom SSL, if you want to use your user custom SSL then need to scale up to app service plan from to basic or higher.
After scaling up the App service plan, it will apply to all your websites in your app service plan.
2. How to resolve it
Please have a try to create another free app service plan for the 3 websites. Detail please refer to how to create-a-new-app-service-plan and Move an app to a different App Service plan.
Note: Only valid plans (in the same resource group and geographical location) are shown.
With Azure websites you are basically renting an IIS instance. In order to use SSL on your website you need to switch your plan to "Basic" or higher, as you've seen. Right now I think all of your websites are in the same "webhosting" plan. This means that they are automatically scaled to the "Basic", as you are basically scaling the IIS instance, not the indiviudual website.
See it as buying a hosting plan that can host multiple web applications. If you move to basic, you end up paying for 1 basic plan that hosts all 4 sites (so not 4 billable plans, just 1).
In this case you won't end up with a higher bill (you need a basic instance for the SSL-site anyway) - the other sites are including in this same hosting plan for 'free' - sharing the resources of the basic instance).
If you want to keep the basic site and the 3 free sites separated, you should create a new webhosting plan (App service plan) on the new Azure Portal (https://portal.azure.com) and move those 3 websites there.
I would recommend letting those 3 sites use the basic plan - it won't cost you any extra.

Is it possible to move custom domain from one web app to another?

I have a custom domain www.abc.com configured for web app webapp-a, and I'd like to transfer it to webapp-b without downtime.
If I try to add the domain to webapp-b, I am getting
The host name www.abc.com is already assigned to another Azure website: webapp-a
It there a way to let webapp-a continues to serve the requests, until the DNS cache expires?
Edit: The domain has IP based SSL binding, and the DNS is caching the virtual IP.
I faced the same issue, and was able to solve it in a tricky way.
I created new App Service Plan (previously known as Web Hosting Plan), and assigned "new" Web App to it (you can do it via new portal, or you can create Service Plan during Web App creation).
Then, I was able to assign the same host name to Web Apps in different hosting plans.
Thinking about this, I feel it logical: most probably Service Plan is mapped to physical IIS machine, and you cannot have two sites with the same host name in the same IIS for the obvious reason.
After migration from one DNS to another is done, you can remove unused Service Plan (as you basically pay for each separately).
According to a blog post by the Azure App Service Team in June 2017, it would appear that Azure now supports adding the same custom domain to multiple web apps:
There are scenarios where a customer would like to add the same hostname to multiple web apps in the same subscription, having a geo distributed website is one example. Our custom hostname feature allows you to bypass validation for hostnames that have already been validated. You only need to verify domain ownership when you add a hostname for the first time. For all other apps in the same subscription, you can add the same hostname without creating any DNS records.
You can read the entire blog post at https://blogs.msdn.microsoft.com/appserviceteam/2017/06/21/custom-hostnames-with-app-service/. The quote above was taken from the Adding the same custom hostname to multiple web apps section.
This should help in scenarios such as this where you want to transfer a custom domain name from one web app to another. You can simply add the same custom domain name to both web apps, add any required SSL bindings, and then change the DNS to point to the new web app. As the DNS change propagates, traffic should gradually move over to the new web app without any downtime.
I've tested this myself in the North Europe region and had no problems. Both web apps were in different App Service Plans. I have not tested this scenario with both web apps in the same App Service Plan. Bear in mind that if you're using IP addresses/A records in your DNS, you'd need both web apps to have different IP addresses for the DNS to be able to differentiate between your web apps.
Try assigning the domain to Azure Traffic Manager and have the traffic manager forward the request to the second site. Azure Traffic Manager and Web Apps are two different systems so you might be able to assign the same domain name to a web app and a traffic manager.
Once the DNS cache has expired remove the domain from the old Azure web app and add it to the new one, then finally delete the Traffic Manager account.
Option 2
Set the TTL to something very small, say 5 seconds (I believe your hostname provider should let you set that up), wait for the new TTL to propagate through all the caches. Then switch the custom domain from one app to another, and set the TTL back to it's original value.
This will result in just a few seconds of downtime for any customers, but if you do it at a low-traffic time the effect shouldn't be too bad.

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

Map custom domain (and wildcard sub-domains) to Azure Website

I've looked at all related posts in MSDN and stack overflow but still having difficulty finding a solution.
I am looking to map a domain and all sub-domains to my windows azure website. It is a reserved website instance. I am using Amazon Route 53 DNS manager and have mapped a wildcard CNAME to my azure sub domain, and created a redirect on the naked domain to the www. subdomain.
When I navigate to the naked root, the redirect kicks in and I'm brought to www..com, where I receive a 404 error from azure.
I know the wildcard CNAME is working. I've verified using MXToolbox. If I go to "Manage Domains" in the Azure web UI admin system, I can manually add "www..com" or any other subdomain (e.g. "helloworld..com"). Azure verifies it fine and after saving, I can pull up the website fine by navigating to that subdomain and my azure website loads.
Is there any way to add wild card subdomains without having to verify each one manually through the azure ui interface? My application is a SaaS that relies on custom user sub-domains to serve up their branded website and gain access to their account so I need any and all subdomains to map to my application.
Currently, wildcard domains are not supported as far as I know. At least on Windows Azure Web Sites. They are on the roadmap, but currently you'll have to rely on adding every domain manually.
See wildcard comment on "Configuring a custom domain name for a Windows Azure web site".
Another feature not yet available on Azure Web Sites is SSL using a vanity (your own) domain name. If you want full control of your site(s) you can use Azure Cloud Services instead of Web Sites. With Cloud Services you can provision certificates, domain names, and run multiple sites on the same instances using host header routing.
Anything you can do with IIS Management you can do with a cloud service.
You're a little closer to the metal compared to Azure Web Sites (but not as close as with a VM) and you get load balancing, scaling, caching, and other goodness. Visual Studio 2010/2012 has excellent deployment tooling. You will need to study up on Azure deployment projects from VS, bit it's not bad.

Resources