Cloudflare Registrar with Azure DNS Routing

Igor 0 Reputation points
2023-10-03T07:18:40.8866667+00:00

Dear team,

I'm trying to replicate the same setup that I have with AWS Route53, Lambdas & CloudFront.

I procured a domain with CloudFlare Registrar. Now, I want to route traffic from CloudFlare to Azure. On Azure, I have a Static Web Page and a few Function Apps. I want to route my traffic as:

  • mydomain.com -> static web app
  • mydomain.com/api/function_one -> Function App "One"
  • mydomain.com/api/function_two -> Function App "Two"

With AWS I achieve this with "Simple Routing" in Route53 where I route my traffic from CloudFlare to AWS with CNAME. On the AWS side, from Route53 I route my Traffic to Lambdas or CloudFront (CDN & S3) for the Web Page.

How can I achieve the same setup with Azure? I'm trying to use Azure DNS; Azure Storage & FrontDoor for web-page; Azure Function Apps & Azure API Management for serverless functions;

Is the only way to do it is to register each URL with a unique CNAME on Cloudflare? i.e. one CNAME for each Function App & Front Door?

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
675 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,978 questions
Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
677 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
926 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sedat SALMAN 13,825 Reputation points
    2023-10-03T08:50:12.2166667+00:00

    this post may help you detailly

    https://pmichaels.net/2021/07/24/configure-cloudflare-to-work-with-your-azure-domain-registration/

    but as a summary

    1. Domain Configuration on Cloudflare:
      1. Add your domain to your Cloudflare account.
      In the DNS settings of Cloudflare, create CNAME records for your domain and subdomains pointing to Azure Front Door or Azure DNS.
    2. Azure Front Door Configuration:
      1. Set up Azure Front Door with a custom domain.
      Define routing rules in Azure Front Door to route traffic to your Static Web App and Azure Function Apps based on the URL path.
    3. Azure Function Apps Configuration:
      1. Deploy your function apps in Azure and note down the function URLs.
    4. Azure API Management Configuration:
      1. Set up Azure API Management and import the function apps.
      Define the API operations for your function apps in Azure API Management.
    5. Azure DNS Configuration (If you use Azure DNS instead of Azure Front Door):
      1. Create a DNS Zone in Azure DNS.
        1. Configure the necessary DNS records to route traffic to your Static Web App, Azure Function Apps, and Azure API Management.

  2. ChaitanyaNaykodi-MSFT 26,101 Reputation points Microsoft Employee
    2023-10-14T02:03:33.2833333+00:00

    @Igor

    Thank you for reaching out and sorry for the delayed response here.

    Based on your statement above.

    I have a Static Web Page and a few Function Apps. I want to route my traffic as:

    • mydomain.com -> static web app
    • mydomain.com/api/function_one -> Function App "One"
    • mydomain.com/api/function_two -> Function App "Two"

    I understand the example domain mydomain.com is procured as a domain with CloudFlare Registrar.

    I this case I think you can configure Azure Front Door with static web app, Function App "One" and

    Function App "Two" as the origin and then use routing rules in Azure Front Door to establish the routes in your statement above.

    A route in Azure Front Door defines how traffic gets handled when the incoming request arrives at the Azure Front Door edge. You can find more information in the articles below.

    https://video2.skills-academy.com/en-us/azure/frontdoor/front-door-route-matching?pivots=front-door-standard-premium

    https://video2.skills-academy.com/en-us/azure/frontdoor/front-door-routing-architecture?pivots=front-door-standard-premium

    How can I achieve the same setup with Azure? I'm trying to use Azure DNS; Azure Storage & FrontDoor for web-page; Azure Function Apps & Azure API Management for serverless functions; Is the only way to do it is to register each URL with a unique CNAME on Cloudflare? i.e. one CNAME for each Function App & Front Door?

    Now since the Web App and Function Apps will be added as origin to the Front Door, so will need to register the CNAME of the Front Door with Cloudflare.

    In order to do this, you can follow this documentation to add a custom domain on your Azure Front Door.

    When you add a domain to your Azure Front Door profile, you configure two records in your DNS server:

    • A DNS TXT record, which is required to validate ownership of your domain name. For more information on the DNS TXT records, see Domain validation.
    • A DNS CNAME record, which controls the flow of internet traffic to Azure Front Door.

    In this case when you add the domain mydomain.com to Azure Front Door as a custom domain name then it will resolve to Azure Front Door over the internet using the CNAME and Azure Front Door based on the routing rules configured will forward the traffic to respective web apps and functions apps.

    In your statement above you have also mentioned about Azure APIM, depending on your architecture you can go over this tutorial to Configure Front Door Standard/Premium in front of Azure API Management.

    Hope this helps! Please let me know if you have any additional questions. Thank you!


    ​​Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.