Web app not validating custom domain name - azure

Steps I followed:
Created an web app (registration-ceus.azurewebsites.net)
Created a traffic manager profile, added web app as an endpoint (registrationtmp.trafficmanager.net) Traffic manager opens the web
app. Issue I face while adding custom domain. I have own a domain
(e.g myworkdomain.net)
I am trying to add subdomain to traffic manager profile (testregistration.myworkdomain.net).
testregistration.myworkdomain.net CNAME
registrationtmp.trafficmanager.net
Added CNAME for my web app:
awverify.testregistration.myworkdomain.net CNAME
awverify.testregistration.registration-ceus.azurewebsites.net
When trying to add the Custom domain awverify.testregistration.myworkdomain.net to my web app, web app
does not validate the domain name. It always gives option to Add
Hostname.
When I try to access testregistration.myworkdomain.net, gets 404 error.
The app service is in Standard tier. What step am I missing or doing wrong?

Related

How to have multiple host names for azure website

I created an web app for a demo website in Azure. The domain name for this website was created when I created the app service "myapp1.azurewebsites.net". I'd like to use additional domain names using the same azurewebsites.net such as myapp2.azurewebsites.net. When I try to add this custom domain it tells me
Failed to add hostname myapp2.azurewebsites.net. Too many (2)
hostnames in the default DNS zone. Limit is 1
Is there no way around this or must I use my own custom DNS name?
For this you need to add custom domain in Azure web app.
For example : when I created the app service "myapp1.azurewebsites.net" and want to have additional domain names , you can go for custom domains like abc.com.
You can not have .azurewebsites.net as the custom domain of already existing web app as it is already owned by Microsoft Azure web app.

Access azure webapp with the CNAME which is behind an Azure Application gateway

I have an azure web app and its corresponding application gateway.
I have created a CNAME and pointed it to the DNS name of the app gateway.
Now when I access the site using the CNAME, it reaches the app gateway and redirects me to the web app(actual web app URL ...azurewebsites.net).
Is it possible that using the CNAME, I should be able to reach the web app i.e. on the address bar it should be displaying the same CNAME to reaching the web app(it should not redirect to the web app)
Thanks.
You could configure the custom domain like sub.example.com to the web app first, then you could add such custom domain in the hostnames of Azure web app service. Once the DNS propagation happens, the CNAME record of the custom domain in the DNS zone should be changed to map the FQDN of the Application gateway like xxx.cloudapp.net.
I test this using web app service without HTTPS redirection. HTTPS Only is off. Azure Application Gateway is also working for HTTP. If you want to use HTTPS for the web app, you need an SSL cert for the custom domain.
Tutorial: Map an existing custom DNS name to Azure App Service
Update
In this case, you properly set HTTPS only is on in the custom domains of Azure web app service. For me, I could still set "Pick up hostname from the backend pool" under the HTTP setting even I do not add the hostnames as my previous reply. The redirection actually is related to the "HTTPS only" under Custom Domain in Azure web app.
I got this issue fixed:
The redirection that was occurring was due to a setting "Pick up hostname from the backend pool" under HTTP setting of application gateway. Removing that setting, using the CNAME we were able to reach the web app but we were getting an error "Too_Many_redirects" and this was resolved once the "HTTPS only" is set to off on the web app under Custom Domain as this redirection was configured at the gateway level.

How to test Azure Web App that requires custom domain without using public DNS

I have an Azure Webapp on a Standard 1 Small App Service Plan, I deployed my application successfully to the webapp, but now I need to test it using a specific domain name that on client side could be configured using hosts file.
The problem is that the Azure webapp will only "recognize" the custom/specific domain (ex: myapp.mydomain.com) if I configure a Custom Domain that uses public DNS and I can't (at this moment) configure the existing domain name to be a CNAME to the Azure webapp because it is production environment, I can and will make the CNAME after the application is tested not before.
My application requires to be called by the specific domain name.
So how can I test my application on Azure webapp using a custom domain but without using public DNS using only my hosts file client side?
note: this problem doesn't even exist in AWS Beanstalk so why is this so complicated with Azure webapp. Its pretty basic
You can preemptively associate your custom domain name with your web app and test it via a client using the host file. To verify domain ownership, Add a TXT record. The TXT record maps from awverify.<subdomain> to <appname>.azurewebsites.net. Steps to do this are outlined here:
https://learn.microsoft.com/en-us/azure/app-service/manage-custom-dns-migrate-domain
Using App Service, I don't think you can do this.
It configures the underlying app to only listen for domains configured in the Web App.
So if you don't add the domain as a custom domain, requests won't be routed to the app.
The reason is that IP addresses are shared, so Azure relies on the Host header to route your request correctly.
You can add the custom domain without CNAME / A record by using the awverify record mentioned by Ken.

Nested Profiles in Azure Traffic Manager not working properly

I had created two Traffic manager profiles naming as Firstprofile, Secondprofile.Firstly Secondprofile configured with app service end point. Now Secondprofile added as Endpoint to Firstprofile (called nested profile) .While browsing the Firstprofile showing the error as follows "Error 404 - Web app not found"
The HTTP request you make to your Web App includes a 'Host' header containing the domain name used in the request. This must be recognized by the Web App. The standard Web App domain name (foo.azurewebsites.net) always works, any other domain names appear in the Web App's custom domains list.
When you add a Web App to Traffic Manager, the Traffic Manager profile's domain name (child.trafficmanager.net) is automatically added to the Web App's custom domains list. So far, so good.
There is a known issue in the Web App / Traffic Manager integration that when using nested Traffic Manager profiles, the domain name of the parent profile (parent.trafficmanager.net) is not added to the Web App custom domain list. This is why you're seeing 404 errors when trying to access the Web App via the parent profile.
As a workaround, you should configure a DNS record in a vanity domain (e.g. www.contoso.com) as a CNAME to parent.trafficmanager.net, and register the vanity domain name as a custom domain in your Web App. Access to the web app via the vanity domain should now work, and this will use the nested Traffic Manager profile as part of the DNS resolution.
Jonathan (Program Manager, Azure Traffic Manager)
The problem is exactly what Jonathan Tuliani mentioned, but there is an alternative solution.
You need to add the parent Traffic Manager profile's domain name to the Web App.
Just go to Custom Domains and SSL -> Bring external domain -> enter the domain name e.g. tmdemo.trafficmanager.net. It will get allowed and everything works.
I just wrote a blog post about it: Nested Traffic Manager profiles

Azure Traffic Manager routing to Azure Website configured as External Endpoint

Here's what I did,
Created an Azure Website (http://myapp1.azurewebsites.net) in Standard tier
Configured Azure Traffic Manager and added endpoint as an Azure endpoint. Trafficmanager routes to the website. Nice!
Removed the endpoint and and added endpoint as an External endpoint. Trafficmanager routes to a 404 page. I provided the FQDN (Fully Qualified domain name) as myapp1.azurewebsites.net.
What is wrong with it? Doesn't Azure allow to have .azurewebsites.net sites to define as endpoint urls?
Endpoint details,
Status - Enabled
Monitor Status - Degraded
Type - External Endpoint
Complete error page details,
Error 404 - Web app not found.
The web app you have attempted to reach is not available in this Microsoft Azure App Service region. This could be due to one of several reasons:
1. The web app owner has registered a custom domain to point to the Microsoft Azure App Service, but has not yet configured Azure to recognize it. Click here to read more.
2. The web app owner has moved the web app to a different region, but the DNS cache is still directing to the old IP Address that was used in the previous region. Click here to read more.
When using a web site, the web site needs to know what domain name to expect in the 'host' header of the DNS request. This is the domain name the user types into their browser.
When you add a web site as an endpoint in Traffic Manager, the Traffic Manager domain name (e.g. mysite.trafficmanager.net) is automatically added as a custom domain name in your web site. And when you remove the web site endpoint, it is removed once again.
However, if you use the external endpoint type, this does not happen. Because the web site does not recognize the domain name in the host header, a 404 error is returned.
To make this work, you will need to put a vanity domain name in front of Traffic Manager using a CNAME, register the vanity domain name in your web site, and use the vanity domain name from your browser. (You cannot manually add the Traffic Manager domain name to the web site since you cannot complete the proof-of-ownership validation which web sites demand.)
External endpoint needs to be outside Azure website.

Resources