How to Purge Azure CDN with PowerShell.

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.