Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✔️ Front Door Standard ✔️ Front Door Premium
Azure Front Door caches assets until their time-to-live (TTL) expires. When a client requests an asset with an expired TTL, Azure Front Door retrieves and caches a new copy of the asset.
To ensure users always get the latest assets, version your assets for each update and publish them with new URLs. Azure Front Door fetches the new assets for subsequent client requests. However, you might need to purge cached content from all edge nodes to force them to retrieve updated assets, especially after making updates or correcting incorrect information.
Prerequisites
- An Azure account with an active subscription. Create an account for free.
- Azure PowerShell installed locally or Azure Cloud Shell.
Note
We recommend that you use the Azure Az PowerShell module to interact with Azure. To get started, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
Azure Cloud Shell
Azure hosts Azure Cloud Shell, an interactive shell environment that you can use through your browser. You can use either Bash or PowerShell with Cloud Shell to work with Azure services. You can use the Cloud Shell preinstalled commands to run the code in this article, without having to install anything on your local environment.
To start Azure Cloud Shell:
Option | Example/Link |
---|---|
Select Try It in the upper-right corner of a code or command block. Selecting Try It doesn't automatically copy the code or command to Cloud Shell. | ![]() |
Go to https://shell.azure.com, or select the Launch Cloud Shell button to open Cloud Shell in your browser. | ![]() |
Select the Cloud Shell button on the menu bar at the upper right in the Azure portal. | ![]() |
To use Azure Cloud Shell:
Start Cloud Shell.
Select the Copy button on a code block (or command block) to copy the code or command.
Paste the code or command into the Cloud Shell session by selecting Ctrl+Shift+V on Windows and Linux, or by selecting Cmd+Shift+V on macOS.
Select Enter to run the code or command.
- Review Caching with Azure Front Door to understand how caching works.
- Have a functioning Azure Front Door profile. Refer to Create an Azure Front Door - PowerShell to learn how to create one.
Configure Cache Purge
Use the Clear-AzFrontDoorCdnEndpointContent cmdlet to purge cache by specifying parameters such as:
- Resource group name.
- Azure Front Door profile name within the resource group.
- Endpoints with assets to purge.
- Domains/Subdomains with assets to purge.
Important
Cache purge for wildcard domains is not supported. Specify subdomains for cache purge in wildcard domains. For example, for the wildcard domain *.afdxgatest.azfdtest.xyz
, use subdomains like contoso.afdxgatest.azfdtest.xyz
or cart.afdxgatest.azfdtest.xyz
. For more information, see Wildcard domains in Azure Front Door.
- Path to the content to be purged:
- Single path purge: Specify the full path of the asset (without the protocol and domain), including the file extension, for example,
/pictures/strasbourg.png
. - Root domain purge: Purge the root of the endpoint with "/*" in the path.
- Single path purge: Specify the full path of the asset (without the protocol and domain), including the file extension, for example,
Clear-AzFrontDoorCdnEndpointContent `
-ResourceGroupName myRGFD `
-ProfileName contosoafd `
-EndpointName myendpoint `
-Domain www.contoso.com `
-ContentPath /scripts/*
Cache purges on the Azure Front Door profile are case-insensitive and query string agnostic, meaning purging a URL purges all its query-string variations.
Note
Cache purging can take up to 10 minutes to propagate throughout the network and across all edge locations.
Next steps
Learn how to create an Azure Front Door profile.