How to know which Traffic manager endpoint served the request - azure

My traffic manager with performance routing method has two endpoints.They are in different region. I wanted to validate when I make a request to webpage, which endpoints served that requests. Is there a way to validate that, like any third party website or some tool in Azure itself?

You can use Traffic View to achieve the purpose. In Azure portal, find your Traffic Manager. Then click Traffic view in left and enable Traffic view.
After that, you can check DNS QUERY SOURCE IP and ENDPOINT to see where the request come from and which endpoint serve this request.
The result likes this screenshot:

Related

Azure Traffic Manager Custom Header for routing to endpoint

I have a multi-tenant SaaS app that has been running behind Azure Traffic Manager (Configured using the Priority method) for some time now. (Tenants are identified by subdomain, ie tenant1.mydomain.com, tenant1.mydomain.com, etc)
Now I have added an endpoint to my Azure Traffic Manager, and specified a Custom Header Setting as follows: host:[tenantX].mydomain.com.
My expectation is that all requests for tenantX.mydomain.com should be now routed to the new endpoint I have added, but logging shows that this is not the case...all requests are still going to the priority 1 endpoint.
Am I missing something, or is this not supposed to be what Azure Traffic Manager's Custom Header settings are supposed to used for? Or should I be changing the routing method? If so, to what?
The Custom Header settings are used to specify a host header ensuring that it hits the correct site when Traffic Manager performs health monitoring. It does not set which requests get routed to which endpoints. You only could define the routing methods via the six traffic-routing methods to determine how to route network traffic to the various service endpoints.
For example, in this blog, you will see that it needs to set the hostname under custom header settings to let Ambassador know which container application in the Kubernetes cluster it should forward the endpoint monitoring request.
Custom header settings This configuration setting helps you add
specific HTTP headers to the health checks that Traffic Manager sends
to endpoints under a profile. The custom headers can be specified at a
profile level to be applicable for all endpoints in that profile and /
or at an endpoint level applicable only to that endpoint. You can use
custom headers for having health checks to endpoints in a multi-tenant
environment be routed correctly to their destination by specifying a
host header. You can also use this setting by adding unique headers
that can be used to identify Traffic Manager originated HTTP(S)
requests and processes them differently. You can specify up to eight
header:value pairs seprated by a comma. For example,
"header1:value1,header2:value2".

Azure Traffic Manager for switching to different API Management Service

So I'm working on building scripts to deploy Azure resources using the Az modules in PowerShell. I am new to Azure Traffic Manager, so I'm wondering if what we are looking to do is even possible, and if so, how.
We have an API Management Service (APIMS) with a handful of APIs in it that point to a few different web apps within Azure. So the way it works currently is we have a client application that will post to a specific API operation via its APIMS URL.
We are looking at the idea of using Traffic Manager purely for moving traffic from one APIMS to a another in the event that we need to create a new APIMS. I can add the existing APIMS as an endpoint to the Traffic Manager as an external endpoint using its public IP address. But beyond that, here's what I'm unsure of:
How exactly would traffic actually get routed through the traffic manager, through the APIMS, to the specific API post? (as in, what would the client application need to specify as where it's sending its post?). Or would this even work??
If we create a new APIMS, can we then simply add that as a new endpoint to the traffic manager (again, as an external endpoint via its IP address), and then delete the old APIMS endpoint?
I did find this question that's similar, but that answer is using Add-AzureTrafficManagerEndpoint as opposed to New-AzTrafficManagerEndpoint, which is what I'm using and apparently does not support -DomainName as a parameter.
Traffic manager does not route traffic, it only does domain name resolution. You could use TM for that. For your custom domain in traffic manager (say contoso.com) you can add CNAME record pointing to contoso.azure-api.net (it's preferable to use CNAME instead of A and APIM service IP may change in certain scenarios). And add SSL certificate in APIM for contoso.com. What will happen in that setup:
Client wants to make request to https://contoso.com/myapi
Client will perform DNS lookup for contoso.com and see CNAME record pointing to contoso.azure-api.net
Client will perform DNS lookup for contoso.azure-api.net and see APIM IP address
Client will try to open SSL connection to APIM
APIM having SSL certificate available will accept the connection
Client will send request.
All this does not require any special configuration from your client apart from setting it up to use "contoso.com" as a hostname for your API. Later if you want to switch to a different APIM service you could go and update TM. Client will not require any changes.
The one thing to know is that this particular setup does not require TM per se. As all you really need is a custom domain from any DNS provider because all you need to do to switch traffic from one APIM to another is update CNAME record.

Azure traffic manager route by URL pattern

We have web apps hosted on two data centers for high availability and we used traffic manager with round robin routing method to route traffic to either of the two data centers.
Now per business requirement, we need route the traffic by URL pattern. Say, for url /api/v1, route to data center 1, for url /api/v2, route to data center 2.
I know traffic manager does not support url based routing. Any workaround?
Azure Traffic Manager operates at the DNS layer and as such does not know any details about the URL related to the DNS request it receives - therefore URL based routing is not possible with Azure Traffic Manager. I encourage you to consider using Azure Application Gateway for URL based routing within a single region. For inter-region routing based on URLs, you could consider making the subdomains different and using DNS layer routing.

Can I map (CNAME) a custom domain to a subdomain that is part of a Wildcard on Azure Web Apps?

I have a website on Azure Cloud Services, and I have enabled a wildcard for my website like: *.mywebsite.com
Then if a customer registers and select as his subdomain: client1.mywebsite.com, I only save the subdomain associated with my customer in the database. I don't need to do anything on the portal. This works as well on Azure Web Apps (Azure Websites).
Now, if my client goes to his domain provider and sets a DNS entry like:
www.client1.com CNAME client1.mywebsite.com
I can handle that correctly in Cloud Services without having to register "www.client1.com" in the Azure Portal. Is that possible in Azure Websites without having to add www.client1.com to the Azure Portal?
Short answer, no, it is not possible.
Explanation.
What you type in the address bar is the name that is presented to a web server in the HTTP request. Regardless of the underlying DNS responses. If a DNS look up of www.example.com provides an IP Address, whether a CNAME or an A record, that is where it will go and get data from. The only way to change that is with a HTTP Redirect.
In Azure the incoming server name is used to direct traffic to the correct web app (On the same set of IP Addresses there might be thousands of other websites registered) The only way it knows how to distinguish where to send the request is from the incoming server name.
Why this worked on Cloud Services.
Behind a cloud service was an IP Address that was unique to your servers behind it. When a cloud service got a HTTP request, it would process it, because there was nowhere else to send it.

How to use azure traffic management with a custom service url endpoint?

I want to provide failover proof url for my service endpoint to users using traffic management. I have a service instance running at http://vm1.cloudapp.net/myservice:8888/index.html. If this instance goes down then the service auto starts on vm2 at http://vm2.cloudapp.net/myservice:8888/index.html n vice versa.
I want azure to hide the underlying service urls to user and expose the service at http://myservice.trafficmanager.net
Is this possible? If so, how ? From reading the documentation of traffic manager service, it looks like you can failover only at DNS level and not at url endpoint level
There are several parts to this.
Firstly, you are right that Traffic Manager works at the DNS level. It doesn't see your HTTP traffic and hence doesn't see the full URL. Since your two services instances have different DNS names, there's no issue here--you configure Traffic Manager with both names as separate 'endpoints', and Traffic Manager will direct traffic to those endpoints by providing one or other in each DNS response.
Secondly, you want to hide the URL paths. Since Traffic Manager works at the DNS level, it doesn't see your HTTP traffic and hence doesn't see the URL, only the domain name. Therefore this is something you have to handle at the application level (just as you would for a single-instance service that doesn't use Traffic Manager).
The only thing to be careful of is to make sure you configure the correct URL port and path in the Traffic Manager endpoint monitoring configuration. Just make sure that Traffic Manager shows your endpoints as 'Online', and you're good.
Jonathan

Resources