{"id":1209,"date":"2019-06-03T02:34:59","date_gmt":"2019-06-03T02:34:59","guid":{"rendered":"https:\/\/www.ciraltos.com\/?p=1209"},"modified":"2023-03-23T23:18:43","modified_gmt":"2023-03-24T04:18:43","slug":"purge-azure-cdn-with-event-grid-and-azure-automation","status":"publish","type":"post","link":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/","title":{"rendered":"Purge Azure CDN with Event Grid and Azure Automation"},"content":{"rendered":"\n<figure class=\"wp-block-image alignleft is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Azure-Automation_COLOR.png\" alt=\"Azure Automation\" class=\"wp-image-1243\" width=\"106\" height=\"106\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Azure-Automation_COLOR.png 512w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Azure-Automation_COLOR-150x150.png 150w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Azure-Automation_COLOR-300x300.png 300w\" sizes=\"(max-width: 106px) 100vw, 106px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image alignleft is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/eventgrid.png\" alt=\"Event Grid\" class=\"wp-image-1244\" width=\"106\" height=\"106\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/eventgrid.png 425w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/eventgrid-150x150.png 150w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/eventgrid-300x300.png 300w\" sizes=\"(max-width: 106px) 100vw, 106px\" \/><\/figure>\n\n\n\n<p>In this post, I demonstrate how to automatically purge content from an Azure Content Delivery Network (CDN) using Event Grid and Azure Automation.&nbsp; I am writing this post with two audiences in mind.&nbsp; First, if you have a CDN and need to purge old content every time content is updated or removed from a source, this post will show you how.&nbsp;&nbsp; However, if you don\u2019t have a CDN but are interested in understanding how to configured Event Grid to trigger automation jobs in an Azure, this post is also for you.<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"ast-oembed-container\" style=\"height: 100%;\"><iframe loading=\"lazy\" title=\"Event Grid and Azure Automation \u2013 Purge CDN Automation Task Walkthrough\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/K7rfrKOZqwk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<h2>Background<\/h2>\n\n\n\n<p>A CDN distributes and caches content across the globe,\nproviding lower latency delivery and reducing global bandwidth usage.&nbsp; It may be necessary to rapidly refresh the\ncache when new content is added to the source.&nbsp;\nThis post will demonstrate how to do that using Event Grid and Azure\nAutomation.<\/p>\n\n\n\n<p>If you would like to follow along at home, you will need an Azure CDN Configured with an Azure Storage Account V2 as the source.&nbsp; I have a post demonstrating how to set that up <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/www.ciraltos.com\/how-to-configure-an-azure-cdn\/\" target=\"_blank\">here<\/a>.  You will also need an Azure Automation account.&nbsp; If you don\u2019t have an Azure Automation account, I have a whole playlist on setting one up <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/www.youtube.com\/playlist?list=PLnWpsLZNgHzUlRBMDKr-svz32frt3x_tC\" target=\"_blank\">here<\/a>.&nbsp; The Azure Automation runbook used in this example can be found <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/github.com\/tsrob50\/Purge-CDN\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<h2>Flow Overview<\/h2>\n\n\n\n<p>The basic flow of operations is as outlined below:<\/p>\n\n\n\n<ol>\n<li>Content added (or removed) from the Storage\nAccount blob source.<\/li>\n\n\n\n<li>Add or Delete action on the blob storage\ntriggers Event Grid.<\/li>\n\n\n\n<li>Event Grid runs a web hook for the Azure\nAutomation runbook, passing JSON data including file path.<\/li>\n\n\n\n<li>The Automation runbook parses JSON and runs a\npurge job against the path.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Event-Grid-Flow.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Event-Grid-Flow.png\" alt=\"\" class=\"wp-image-1210\" width=\"257\" height=\"311\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Grid-Flow.png 343w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Grid-Flow-248x300.png 248w\" sizes=\"(max-width: 257px) 100vw, 257px\" \/><\/a><figcaption class=\"wp-element-caption\">Event Grid Flow<\/figcaption><\/figure>\n\n\n\n<h2>Azure Automation <\/h2>\n\n\n\n<p>The web hook is required to set up the Event Grid action, so\nlet\u2019s start there.&nbsp; Start by going to\nyour Azure Automation account and create a runbook.&nbsp;&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Create-Purge-Runbook.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Create-Purge-Runbook.png\" alt=\"Create Runbook\" class=\"wp-image-1211\" width=\"226\" height=\"230\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Create-Purge-Runbook.png 301w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Create-Purge-Runbook-294x300.png 294w\" sizes=\"(max-width: 226px) 100vw, 226px\" \/><\/a><figcaption class=\"wp-element-caption\"> <br>Create Purge Runbook <\/figcaption><\/figure>\n\n\n\n<p>For this example, I\u2019m only going to publish a single\nwrite-output command as a placeholder.&nbsp;\nRemember, for now, I only need a web hook for the runbook.&nbsp; We will get to the working runbook\nshortly.&nbsp; Save and publish the runbook.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Publish-Temp-Runbook.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Publish-Temp-Runbook.png\" alt=\"PowerShell Runbook\" class=\"wp-image-1212\" width=\"468\" height=\"161\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Publish-Temp-Runbook.png 624w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Publish-Temp-Runbook-300x103.png 300w\" sizes=\"(max-width: 468px) 100vw, 468px\" \/><\/a><figcaption class=\"wp-element-caption\"> Publish Temp Runbook <\/figcaption><\/figure>\n\n\n\n<p>Now that we have a published runbook we can create a web hook to trigger it.&nbsp; From the runbook, go to the <em>Add web hook<\/em> at the top of the page.<\/p>\n\n\n\n<p>This will take you to the first of two steps to create a web\nhook.&nbsp; Give the new web hook a name, make\nsure it\u2019s set to enabled and set an expiration date.&nbsp; Note the date, the web hook will stop working\nafter that date.&nbsp; Lastly, copy and paste\nthe URL someplace secure.&nbsp; You will not\nbe able to retrieve this URL once the web hook has been created.&nbsp; If you lose it, a new one will need to be\ncreated.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Create-Webhook-Step-1.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Create-Webhook-Step-1.png\" alt=\"Webhook\" class=\"wp-image-1213\" width=\"469\" height=\"352\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Create-Webhook-Step-1.png 625w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Create-Webhook-Step-1-300x225.png 300w\" sizes=\"(max-width: 469px) 100vw, 469px\" \/><\/a><figcaption class=\"wp-element-caption\"> Create Web Hook<\/figcaption><\/figure>\n\n\n\n<p>Click <em>OK<\/em> to move to\nthe next step.&nbsp; Specify the run\nenvironment and parameters in the <em>Modify\nrun settings<\/em> section.&nbsp; If the Runbook\nrequired parameters or needs to run on a hybrid worker, that could be set\nhere.&nbsp; Neither applies to this example,\nso click <em>OK <\/em>and <em>Create<\/em> to add the web hook.<\/p>\n\n\n\n<p>The CDN module is required to run the purge command.&nbsp; Add that by going into <em>Modules Gallery<\/em> in the automation account.&nbsp; Search for CDN.&nbsp; Add the Az.CDN module.&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Add-CDN-Module.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Add-CDN-Module-1024x492.png\" alt=\"Azure Automation Module\" class=\"wp-image-1214\" width=\"512\" height=\"246\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Add-CDN-Module-1024x492.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Add-CDN-Module-300x144.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Add-CDN-Module-768x369.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Add-CDN-Module.png 1384w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption class=\"wp-element-caption\">Add CDN Module<\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p> If you are using the default AzureRM commands in the Automation Account, add the AzureRM.CDN module instead.&nbsp; Also change the Unpublish-AzCDNEndpointContent command in the script to the AzureRM command: Unpublish-AzureRMCDNEndpointContent. <\/p>\n<\/blockquote>\n\n\n\n<h2>Event Grid<\/h2>\n\n\n\n<p>Now that we have a web hook, let\u2019s move onto setting up Event\nGrid.&nbsp; Start by going to the Storage\nAccount used as the CDN source. Look for <em>Events<\/em>\non the sidebar of the Storage Account.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Storage-Events.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"239\" height=\"312\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Storage-Events.png\" alt=\"Event Grid\" class=\"wp-image-1215\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Storage-Events.png 239w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Storage-Events-230x300.png 230w\" sizes=\"(max-width: 239px) 100vw, 239px\" \/><\/a><figcaption class=\"wp-element-caption\"> Storage Events <\/figcaption><\/figure>\n\n\n\n<p>This will open the <em>Events,\nGet Started<\/em> page.&nbsp; Select the <em>More Options<\/em> option.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Events-More-Options.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Events-More-Options.png\" alt=\"Event Grid More Options\" class=\"wp-image-1218\" width=\"446\" height=\"209\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Events-More-Options.png 892w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Events-More-Options-300x141.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Events-More-Options-768x360.png 768w\" sizes=\"(max-width: 446px) 100vw, 446px\" \/><\/a><figcaption class=\"wp-element-caption\">Events &#8211; More Options<\/figcaption><\/figure>\n\n\n\n<p>You will see multiple options to choose from.&nbsp; Select the <em>Web Hook<\/em> option.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Web-Hook-Option.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Web-Hook-Option.png\" alt=\"\" class=\"wp-image-1219\" width=\"486\" height=\"429\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Web-Hook-Option.png 648w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Web-Hook-Option-300x265.png 300w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/a><figcaption class=\"wp-element-caption\"> Web Hook Option <\/figcaption><\/figure>\n\n\n\n<p>Give the Event Subscription a name.&nbsp; Leave the Event Schema and <em>Topic Details<\/em> as default.&nbsp; Notice that the <em>Event Types<\/em> have the option of Blob Created or Blob Deleted.&nbsp; Leave both selected.&nbsp; Under <em>Endpoint\nDetails<\/em>, select <em>Web Hook.<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Create-Event-Subscription.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Create-Event-Subscription.png\" alt=\"Event Grid Subscription\" class=\"wp-image-1220\" width=\"501\" height=\"494\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Create-Event-Subscription.png 668w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Create-Event-Subscription-300x296.png 300w\" sizes=\"(max-width: 501px) 100vw, 501px\" \/><\/a><figcaption class=\"wp-element-caption\"> Create Event Subscription <\/figcaption><\/figure>\n\n\n\n<p>Next, under <em>Web Hook, <\/em>click on <em>Select and endpoint.<\/em>&nbsp; This will bring up the <em>Subscriber Endpoint<\/em>.&nbsp; Enter the Web Hook URL created in the previous step.&nbsp; Click <em>Confirm Selection <\/em>and<em> Create <\/em>to add the event.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Select-Web-Hook.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Select-Web-Hook.png\" alt=\"\" class=\"wp-image-1221\" width=\"565\" height=\"149\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Select-Web-Hook.png 565w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Select-Web-Hook-300x79.png 300w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/a><figcaption class=\"wp-element-caption\">Select Web Hook <\/figcaption><\/figure>\n\n\n\n<p>After the event is created, go to <em>Event Subscriptions<\/em> to verify.&nbsp;\nNotice you can watch the activity from the <em>Event Subscriptions<\/em> page.&nbsp; It\nis also possible to modify the event by clicking on the event name.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"559\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Event-Subscriptions-1024x559.png\" alt=\"\" class=\"wp-image-1222\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Subscriptions-1024x559.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Subscriptions-300x164.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Subscriptions-768x419.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Subscriptions.png 1040w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Event Subscriptions <\/figcaption><\/figure>\n\n\n\n<h2>Test the Event<\/h2>\n\n\n\n<p>Now that the web hook is in place, let\u2019s test.&nbsp; The event will trigger when new blobs are\nuploaded or deleted from the container.&nbsp;\nTo test, simply upload or remove content from the container.&nbsp; The example below uses Storage Explorer to download\nand then upload index.html.&nbsp; This adds\ncontent and triggers the event.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Blob-Upload.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Blob-Upload.png\" alt=\"\" class=\"wp-image-1223\" width=\"545\" height=\"283\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Blob-Upload.png 726w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Blob-Upload-300x156.png 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/a><figcaption class=\"wp-element-caption\"> Blob Upload <\/figcaption><\/figure>\n\n\n\n<p>Events now show activity as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Event-Triggered.png\" alt=\"\" class=\"wp-image-1224\" width=\"499\" height=\"451\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Triggered.png 665w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Event-Triggered-300x271.png 300w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><figcaption class=\"wp-element-caption\"> Event Triggered <\/figcaption><\/figure>\n\n\n\n<p>Go to the Azure Automation Runbook.&nbsp; Under <em>Jobs<\/em>,\nyou will see a job completed.&nbsp; This is\nthe job Event Grid triggered.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"608\" height=\"165\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Azure-Automation-Job-Triggered.png\" alt=\"\" class=\"wp-image-1225\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Azure-Automation-Job-Triggered.png 608w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Azure-Automation-Job-Triggered-300x81.png 300w\" sizes=\"(max-width: 608px) 100vw, 608px\" \/><figcaption class=\"wp-element-caption\"> Azure Automation Job Triggered <\/figcaption><\/figure>\n\n\n\n<p>Click on the Job and go to Output.&nbsp; You will see that the job output, in this\nexample a simple message.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"189\" height=\"123\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Runbook-Output.png\" alt=\"\" class=\"wp-image-1226\"\/><figcaption class=\"wp-element-caption\"> Runbook Output <\/figcaption><\/figure>\n\n\n\n<p>The output is not very useful.&nbsp; More important is the input.&nbsp; Notice the input <em>WEBHOOKDATA <\/em>&nbsp;is JSON Code with details about the event.&nbsp; Copy the data into an editor, such as Visual Studio Code and save it as a .json file.&nbsp; I used the Prettier VS Code extension to format the content as JSON. <\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Input-JSON-Data.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Input-JSON-Data-1024x397.png\" alt=\"Runbook Input\" class=\"wp-image-1227\" width=\"512\" height=\"199\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Input-JSON-Data-1024x397.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Input-JSON-Data-300x116.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Input-JSON-Data-768x298.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Input-JSON-Data.png 1031w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Formatted-JSON-Data.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Formatted-JSON-Data-1024x585.png\" alt=\"\" class=\"wp-image-1228\" width=\"512\" height=\"293\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Formatted-JSON-Data-1024x585.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Formatted-JSON-Data-300x171.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Formatted-JSON-Data-768x439.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Formatted-JSON-Data.png 1213w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption class=\"wp-element-caption\">Formatted JSON Data <\/figcaption><\/figure>\n\n\n\n<p>Under <em>RequestBody<\/em>, there are a couple of values that give path information.&nbsp; This information is used below to run a purge against a specific file each time it\u2019s uploaded or deleted.&nbsp; This example will use the value assigned to \u201c<em>url\u201d <\/em>to build a path for the purge operation.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/URL-Path.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/URL-Path-1024x86.png\" alt=\"\" class=\"wp-image-1229\" width=\"512\" height=\"43\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/URL-Path-1024x86.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/URL-Path-300x25.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/URL-Path-768x65.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/URL-Path.png 1635w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption class=\"wp-element-caption\"> URL Path <\/figcaption><\/figure>\n\n\n\n<h2>Azure Automation Runbook<\/h2>\n\n\n\n<p>Almost there! The Event Trigger is configured to fire a\nrunbook.&nbsp; The runbook is configured and\nwe have the parameter needed to run the purge command.&nbsp; The last step is to build a runbook.&nbsp; <\/p>\n\n\n\n<p>Below I step through each section of the runbook.&nbsp; If you are unfamiliar with creating runbooks, I have the <a href=\"https:\/\/www.youtube.com\/playlist?list=PLnWpsLZNgHzUlRBMDKr-svz32frt3x_tC\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"YouTube Playlist for you (opens in a new tab)\">YouTube Playlist for you<\/a>!  The complete runbook is available on my GitHub site <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/github.com\/tsrob50\/Purge-CDN\" target=\"_blank\">here<\/a><a href=\"https:\/\/github.com\/tsrob50\/Purge-CDN\"> <\/a>.<\/p>\n\n\n\n<p>The first section in the script is the comments.&nbsp; After that is the parameter section.&nbsp; This adds the JSON input to the $Web hookData\nvariable for use later in identifying the file path.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Parameter-Section.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Parameter-Section.png\" alt=\"Azure Automation Runbook\" class=\"wp-image-1230\" width=\"307\" height=\"126\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Parameter-Section.png 307w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Parameter-Section-300x123.png 300w\" sizes=\"(max-width: 307px) 100vw, 307px\" \/><\/a><figcaption class=\"wp-element-caption\"> Parameter Section <\/figcaption><\/figure>\n\n\n\n<p>After the parameter section is the authentication\nsection.&nbsp; This authenticates the runbook\nwith the Azure Automation Run As account, giving it permissions to run the\npurge command.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Authentication-Section.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"496\" height=\"253\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Authentication-Section.png\" alt=\"Azure Automation Runbook\" class=\"wp-image-1231\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Authentication-Section.png 496w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Authentication-Section-300x153.png 300w\" sizes=\"(max-width: 496px) 100vw, 496px\" \/><\/a><figcaption class=\"wp-element-caption\"> Authentication Section <\/figcaption><\/figure>\n\n\n\n<p>The next section assigns the CDN Profile name, Resource\nGroup and Endpoint Name to variables.&nbsp; Update\nthese fields with values from your environment.&nbsp;\nI also set the default error action to a variable, this is used for\nerror handling.&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Set-Variables.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Set-Variables.png\" alt=\"Azure Automation Runbook\" class=\"wp-image-1232\"\/><\/a><figcaption class=\"wp-element-caption\"> Set Variables  <\/figcaption><\/figure>\n\n\n\n<p>After that, I manipulate the JSON data to get the correct file path.&nbsp; The data I need is in the <em>RequestBody<\/em> section of the JSON, the first step is to assign that data to a new variable, $requestbody<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Variable-requestBody.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"649\" height=\"177\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Variable-requestBody.png\" alt=\"Azure Automation Runbook\" class=\"wp-image-1233\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Variable-requestBody.png 649w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Variable-requestBody-300x82.png 300w\" sizes=\"(max-width: 649px) 100vw, 649px\" \/><\/a><figcaption class=\"wp-element-caption\"> Variable requestBody<\/figcaption><\/figure>\n\n\n\n<p>Once that\u2019s assigned, I assign the value of \u201c<em>url\u201d<\/em> located in <em>data<\/em> to the $filePath variable.&nbsp; The value of <em>url<\/em> includes the full FQDN and file path.&nbsp; I don\u2019t need the FQDN for the purge command, only the file path.&nbsp; The <em>replace<\/em> command is used to replace the FQDN with nothing, removing the part of the url I don\u2019t need. For example, if this is the full url:<br><br>https:\/\/cdntestcir.blob.core.windows.net\/source\/index.html<br><br>replacing \u201chttps:\/\/cdntestcir.blob.core.windows.net\u201d with \u201cnothing\u201d will leave \u201c\/source\/index.html\u201d, the path needed for the purge command.&nbsp; Update the <em>url<\/em> value from your environment. <\/p>\n\n\n\n<p>The full command looks like below.&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Convert-File-Path.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"725\" height=\"243\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Convert-File-Path.png\" alt=\"Azure Automation Runbook\" class=\"wp-image-1235\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Convert-File-Path.png 725w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Convert-File-Path-300x101.png 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/a><figcaption class=\"wp-element-caption\"> Convert File Path <\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>The try, catch blocks are used for error handling.&nbsp; Errors encountered as the runbook runs are written to the Error stream.&nbsp; For more information on the Try, Catch, Finally, blocks, see \u201cThe Big Book of PowerShell Error Handling\u201d available from PowerShell.org <a href=\"https:\/\/leanpub.com\/u\/devopscollective\">https:\/\/leanpub.com\/u\/devopscollective<\/a><\/p>\n<\/blockquote>\n\n\n\n<p>Last, the unpublish-AzCDNEndpointContent command is used to purge\nthe file.&nbsp; This command takes a minute or\ntwo to run.&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Unpublish-AzCdnEndpointContent-Command.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Unpublish-AzCdnEndpointContent-Command-1024x239.png\" alt=\"\" class=\"wp-image-1236\" width=\"512\" height=\"120\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Unpublish-AzCdnEndpointContent-Command-1024x239.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Unpublish-AzCdnEndpointContent-Command-300x70.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Unpublish-AzCdnEndpointContent-Command-768x179.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Unpublish-AzCdnEndpointContent-Command.png 2035w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption class=\"wp-element-caption\"> Unpublish-AzCdnEndpointContent Command <\/figcaption><\/figure>\n\n\n\n<h2>Final Testing<\/h2>\n\n\n\n<p>Test by updating or deleting a file from the CDN Source\nStorage Account.&nbsp; This will trigger Event\nGrid to send the web hook and cause the Runbook to run. &nbsp;The Azure Automation runbook will report the completed\njob once finished.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Completed-Job.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"190\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Completed-Job-1024x190.png\" alt=\"\" class=\"wp-image-1237\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Completed-Job-1024x190.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Completed-Job-300x56.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Completed-Job-768x143.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Completed-Job.png 1555w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\"> Completed Job <\/figcaption><\/figure>\n\n\n\n<p>The <em>Activity Log<\/em>\non the <em>CDN Endpoint<\/em> will show a\nsuccessful purge.&nbsp; Clicking on the drop-down\narrow will show details of the job.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Successful-Purge.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"277\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/06\/Successful-Purge-1024x277.png\" alt=\"Event Grid and Azure Automation\" class=\"wp-image-1238\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Successful-Purge-1024x277.png 1024w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Successful-Purge-300x81.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Successful-Purge-768x207.png 768w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/06\/Successful-Purge.png 1833w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\"> Successful Purge <\/figcaption><\/figure>\n\n\n\n<h2>Summary<\/h2>\n\n\n\n<p>Here we are at the end.&nbsp; This post demonstrated how to use Event Grid and Azure Automation to automate the process of purging content from a CDN when content is deleted from the source or new content is added.&nbsp; The CDN use case is fairly specific, but Event Grid is integrated into many Azure services and the same workflow could be applied to a multitude of services to automate within Azure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, I demonstrate how to automatically purge content from an Azure Content Delivery Network (CDN) using Event Grid and Azure Automation.&nbsp; I am writing this post with two audiences in mind.&nbsp; First, if you have a CDN and need to purge old content every time content is updated or removed from a source, &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\"> <span class=\"screen-reader-text\">Purge Azure CDN with Event Grid and Azure Automation<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":3740,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[2,252],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Purge Azure CDN with Event Grid and Azure Automation - ciraltos<\/title>\n<meta name=\"description\" content=\"This is a step by step to use Azure Event Grid and Azure Automation to automat tasks in Auzre. The example walks thorugh purging an Azure CDN cache as files are updated.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Purge Azure CDN with Event Grid and Azure Automation - ciraltos\" \/>\n<meta property=\"og:description\" content=\"This is a step by step to use Azure Event Grid and Azure Automation to automat tasks in Auzre. The example walks thorugh purging an Azure CDN cache as files are updated.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\" \/>\n<meta property=\"og:site_name\" content=\"ciraltos\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-03T02:34:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-24T04:18:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2022\/10\/PowerShellDSC.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Travis Roberts\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:site\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Travis Roberts\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\"},\"author\":{\"name\":\"Travis Roberts\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"headline\":\"Purge Azure CDN with Event Grid and Azure Automation\",\"datePublished\":\"2019-06-03T02:34:59+00:00\",\"dateModified\":\"2023-03-24T04:18:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\"},\"wordCount\":1643,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"articleSection\":[\"Azure\",\"Azure Automation\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\",\"name\":\"Purge Azure CDN with Event Grid and Azure Automation - ciraltos\",\"isPartOf\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\"},\"datePublished\":\"2019-06-03T02:34:59+00:00\",\"dateModified\":\"2023-03-24T04:18:43+00:00\",\"description\":\"This is a step by step to use Azure Event Grid and Azure Automation to automat tasks in Auzre. The example walks thorugh purging an Azure CDN cache as files are updated.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.ciraltos.com\/staging2\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Purge Azure CDN with Event Grid and Azure Automation\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\",\"url\":\"http:\/\/www.ciraltos.com\/staging2\/\",\"name\":\"ciraltos\",\"description\":\"cloud, technology and trends\",\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\",\"name\":\"Travis Roberts\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"contentUrl\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"width\":5657,\"height\":3563,\"caption\":\"Travis Roberts\"},\"logo\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.ciraltos.com\",\"https:\/\/twitter.com\/ciraltos\"],\"url\":\"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Purge Azure CDN with Event Grid and Azure Automation - ciraltos","description":"This is a step by step to use Azure Event Grid and Azure Automation to automat tasks in Auzre. The example walks thorugh purging an Azure CDN cache as files are updated.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/","og_locale":"en_US","og_type":"article","og_title":"Purge Azure CDN with Event Grid and Azure Automation - ciraltos","og_description":"This is a step by step to use Azure Event Grid and Azure Automation to automat tasks in Auzre. The example walks thorugh purging an Azure CDN cache as files are updated.","og_url":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/","og_site_name":"ciraltos","article_published_time":"2019-06-03T02:34:59+00:00","article_modified_time":"2023-03-24T04:18:43+00:00","og_image":[{"width":600,"height":315,"url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2022\/10\/PowerShellDSC.png","type":"image\/png"}],"author":"Travis Roberts","twitter_card":"summary_large_image","twitter_creator":"@ciraltos","twitter_site":"@ciraltos","twitter_misc":{"Written by":"Travis Roberts","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#article","isPartOf":{"@id":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/"},"author":{"name":"Travis Roberts","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"headline":"Purge Azure CDN with Event Grid and Azure Automation","datePublished":"2019-06-03T02:34:59+00:00","dateModified":"2023-03-24T04:18:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/"},"wordCount":1643,"commentCount":0,"publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"articleSection":["Azure","Azure Automation"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/","url":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/","name":"Purge Azure CDN with Event Grid and Azure Automation - ciraltos","isPartOf":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#website"},"datePublished":"2019-06-03T02:34:59+00:00","dateModified":"2023-03-24T04:18:43+00:00","description":"This is a step by step to use Azure Event Grid and Azure Automation to automat tasks in Auzre. The example walks thorugh purging an Azure CDN cache as files are updated.","breadcrumb":{"@id":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.ciraltos.com\/staging2\/purge-azure-cdn-with-event-grid-and-azure-automation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.ciraltos.com\/staging2\/"},{"@type":"ListItem","position":2,"name":"Purge Azure CDN with Event Grid and Azure Automation"}]},{"@type":"WebSite","@id":"http:\/\/www.ciraltos.com\/staging2\/#website","url":"http:\/\/www.ciraltos.com\/staging2\/","name":"ciraltos","description":"cloud, technology and trends","publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a","name":"Travis Roberts","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/","url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","contentUrl":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","width":5657,"height":3563,"caption":"Travis Roberts"},"logo":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.ciraltos.com","https:\/\/twitter.com\/ciraltos"],"url":"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1209"}],"collection":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/comments?post=1209"}],"version-history":[{"count":11,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1209\/revisions"}],"predecessor-version":[{"id":4025,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1209\/revisions\/4025"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media\/3740"}],"wp:attachment":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media?parent=1209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/categories?post=1209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/tags?post=1209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}