PowerShell Script to Purge Multiple Azure Front Doors

I recently worked on a project with close to 100 Azure Front Doors, one for each domain. I found out the hard way that Front Door caches 301 redirects - I needed a way to easily and quickly dump the cache on all 100 Front Doors.

So, PowerShell to the rescue!

Connect-AzAccount
Set-AzContext -SubscriptionId "<your subscription id>"
Get-AzFrontDoor | Foreach-Object { Write-Output "Purging " $_.FriendlyName; Remove-AzFrontDoorContent -ResourceGroupName "<your resource group name>" -Name $_.FriendlyName -ContentPath "/*" }

  • The first line will log you in to Azure.
  • The second line will connect you to your subscription.
  • The third line will loop through each Front Door in the subscription and purge the cached content.

Hope this is helpful to someone!

~David

Add comment

Loading