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

Andre van den Berg
Andre van den Berg
Consultant

Andre works with Azure, Office 365, Intune and automating things with PowerShell as a consultant at The Sourcing Company. He worked as a system/network administrator at Meyra for 18 years and helped people with everything related to IT while innovating the IT infrastructure at the same time. He enjoys attending meetups and events to learn new technologies, talk with interesting people and exchange stickers. He turned his hobby into his job and loves to blog, work on IoT projects at home and read books to his daughter.

comments powered by Disqus

Related