how to clear cache of azure frontdoor?

Deshmukh, Vijit 516 Reputation points
2022-07-13T07:35:29.133+00:00

Hi Team,

I want to purge the azure front door cache using az cli commands.
As per the document I tried the below command, but it is giving info message and error.

command used : az afd endpoint purge -g (resource group name) --profile-name (profile name from endpoint designer) --endpoint-name (endpoint name)
--content-paths '/styles.css'

Please let me know if is there any command to purge azure front door cache.

Screen shot attached.

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
850 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 50,021 Reputation points Microsoft Employee Moderator
    2022-07-13T11:23:17.617+00:00

    Hello @Deshmukh, Vijit ,

    Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

    I understand that you are trying to purge Azure Front Door cache using Azure CLI but it is failing with an "AuthorizationFailed" error.

    The "AuthorizationFailed" error states that you do not have authorization to perform a purge action on the Front Door endpoint. Could you please check if you have the required permissions and try again?
    You should have the following RBAC permission "Microsoft.Network/frontDoors/purge/action" to be able to purge cached content from a Front Door resource.
    Refer : https://learn.microsoft.com/en-us/azure/role-based-access-control/resource-provider-operations#microsoftnetwork

    Now, coming back to the Azure CLI commands,

    If you have Azure Front Door Standard/Premium, then you can use the below command to purge cache:
    az afd endpoint purge -g group --profile-name profile --domains www.contoso.com --content-paths '/scripts/'*
    Refer : https://learn.microsoft.com/en-us/cli/azure/afd/endpoint?view=azure-cli-latest#az-afd-endpoint-purge

    If you have Azure Front Door Classic, then you can use the below command to purge cache:
    az network front-door purge-endpoint --content-paths '/scripts/' --name name --resource-group rgname*
    Refer : https://learn.microsoft.com/en-us/cli/azure/network/front-door?view=azure-cli-latest#az-network-front-door-purge-endpoint

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

    ----------------------------------------------------------------------------------------------------------------

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


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.