Azure, Usage of CDN API to Load and Purge content

Azure CDN is a great and powerful feature that is straightforward to setup and configure, but the management of the CDN content can be performed only via the Azure Portal or directly invoking the CDN APIs. There are no CDN PowerShell cmdlets at the moment.

If the operation completes successfully the status code will be 202, and the response headers will contain some azure related fields like the GUID of the operation. In case of errors the WebClient instance throws an exception.

Remember that this API is async so it returns almost immediately but the requested operation might take some time to complete on the CDN side.

Last, if you want to check if a CDN resource has been properly loaded/purged you can inspect the response header of the CDN url: