How to update existing azfrontdoor route using powershell

Yuvaraj Duraisamy 20 Reputation points
2025-01-24T12:26:22.95+00:00

User's image

test.axv3-dns.com is configured default

how to update test2.axv3-dns.com using powershell.

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
731 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,762 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sai Prasanna Sinde 3,410 Reputation points Microsoft Vendor
    2025-01-27T07:18:34.5733333+00:00

    Hi @Yuvaraj Duraisamy

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    Kindly try the below sample commands to update your domain in azure front door:

    # Set variables (Replace with your actual values) 
    $resourceGroupName = "YourResourceGroupName"  # Replace with your resource group name 
    $frontDoorName = "axv3" 
    $routeName = "route1" 
    $newDomain = "test2.axv3-dns.com"
    # You can get the existing Front Door route by using below command:
    $route = Get-AzFrontDoorRoute -ResourceGroupName $resourceGroupName -FrontDoorName $frontDoorName -Name $routeName
    # You can get the existing domains by using below command:
    $existingDomains = $route.Domain
     # You can add the new domain to the list by using below command:
    $newDomains = $existingDomains + $newDomain
     # You can update the route with the new domain list by using below command:
    Update-AzFrontDoorRoute -ResourceGroupName $resourceGroupName -FrontDoorName $frontDoorName -Name $routeName -Domain $newDomains
     # Also, you can verify the update by using below command:
    $updatedRoute = Get-AzFrontDoorRoute -ResourceGroupName $resourceGroupName -FrontDoorName $frontDoorName -Name $routeName Write-Host "Updated Domains:" $updatedRoute.Domain
    
    • Before you can use test2.axv3-dns.com with Front Door, you'll need to validate it. This usually involves creating specific DNS records (like TXT or CNAME records) as instructed by Azure Front Door during the validation process.
    • You can add a new domain using the New-AzFrontDoorCustomDomain cmdlet and validate it with Update-AzFrontDoorCustomDomainValidationToken.
    • If you want traffic to test2.axv3-dns.com to follow the same routing rules as test.axv3-dns.com, you might not need to change the "Patterns to match" field.
    • However, if you want different behavior for each domain, you'll need to adjust the path patterns accordingly.

    Kindly let us know if the above helps or you need further assistance on this issue.

    If it was helpful, please click "Upvote and Accept Answer" on this post to let us know.

    We're here to help, so if you have any further questions, don't hesitate to ask.

    Thanks,

    Sai.

    1 person found this answer helpful.

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.