Purge CDN content with Azure CLI in your DevOps CI/CD for Hugo

Purge CDN content with Azure CLI in your DevOps CI/CD for Hugo

After your Azure DevOps CI/CD Pipeline has finished you want that you Azure CDN content get purged so your blog visitors will see the latest content and changes you have made to your blog.

I was searching on the internet with my best friend google and post how you can do this with PowerShell but then I was thinking why not using Azure CLI with AZ.

So found that you can use the following command:

az cdn endpoint purge -g $ResourceGroupName -n $EndpointName --profile-name $ProfileName --content-paths '/*'

So tested this in the Azure Cloud Shell to look if this worked, and after some time the command was finished. So I looked in the log in the Azure portal and did see the following:

Activity Log CDN

Then i added a new task in the Release Pipeline of my DevOps project for Hugo to purge the CDN endpoint for my blog site.

Added Task to Release Pipeline

And added the variables for ResourceGroup, ProfileName, and EndPointName in the Release Pipeline.

Added Task to Release Pipeline

André van den Berg
André van den Berg
Consultant, Blogger, Speaker, Meetup/Event Attendee, Owner of MyStickerBox

André is widely interested, eager to learn and a DevOps enthusiast. He has experience with various projects in the field of lift and shift of on-premise environments to Azure Cloud, migrating databases and web servers of customers at suppliers to their own Azure environments together with the supplier. In addition, he also set up standard Bicep Blueprints for rolling out Azure resources in a consistent way at multiple customers who were managed by MSP. André likes to share his knowledge and is a real team player. In addition, he can also work well independently and is pleasant to deal with.

comments powered by Disqus

Related