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.