How to Purge Azure CDN with PowerShell

Sep 28, 2017. | By: Owen Davies

I needed a script to purge the CDN of this blog, I have the CDN setup already.

Get a list of all the powershell commands for the CDN

get-command -module AzureRM.Cdn

View all your CDN Profiles that you have setup

Get-AzureRmCdnProfile

Purge CDN

$resourceGroupName = ''
$profileName = ''
$endpointName = ''

$cdnEndpoint = Get-AzureRmCdnEndpoint -ResourceGroupName $ResourceGroupName -ProfileName $profileName -EndpointName $endpointName

$cdnEndpoint | Unpublish-AzureRmCdnEndpointContent -PurgeContent "/*"

Conclusion

This is really something you want to have inclued as part of your automated deployment. In a future article I will tie this together with a deployment scenario.

Comments

About

Founded in 2009, Odity is a software consultancy based in the United Kingdom.

Social Links

Our Bunker

United Kingdom.