Search code examples
powershellazure-cdnazure-storage-account

Azure Akamai CDN endpoint not purging content


I've got an CDN endpoint that we have setup serving web content (predominantly js scripts and images). The site is being deployed with Azure DevOps. All has worked well in the passed.

We now have a major website version upgrade and have made a lot of script updates. However, we have noticed that the version if the files being served by the CDN is not changing. I have therefore added an Azure Powershell purge task into our Azure DevOps pipeline to delete the files (using Az). I use the following command:

[string[]]$purge = @(“/lib/app/Controllers/file1.js", “/lib/app/Controllers/files2.js", “/lib/app/Controllers/billingController.js", “/lib/app/Controllers/file3.js", “/lib/app/Controllers/file4.js"");

Unpublish-AzCdnEndpointContent -ResourceGroupName ${{parameters.resourceGroup}} -ProfileName application$(environment) -EndpointName application$(environment) -PurgeContent $purge;

I can see the command work and on checking the activity log on the endpoint, i see the purge has been successfully submitted:

purge activity ;pg

however, when i try and browse the cached file, it has still got the old version. We have deliberately put a date banner into the top of each script file so that we can trace the update, but we are not seeing this in the cached files. I have also navigated to some of the files via the storage account urls and i can see that the files have been updated as expected.

On a separate point, i have tried issuing the above powershell command with /. /folder/, but none of these appear to work. It makes it difficult because we can't see the content of the CDN to know why it is not purging as expected

I've also tried using the az cli. This doesn't appear to work either. Can anyway help please?


Solution

  • I got around this by using Standard_Microsoft as a CDN provider rather than Standard_Akamai that i was using before in Azure.

    This has the added benefit that the wildcard parameter '/*' also works