Content Delivery Network is a distributed network of internet servers. Basically, it is used to deliver static content/information with high bandwidth by caching. In this article, I’m going to explain how to create Azure CDN with Azure Storage Service.
Creating an Azure CDN in Azure Storage
Step 1
Log in to Azure Portal https://portal.azure.com
Click
here to learn how to create an Azure storage.
Step 2
Go to your Azure storage. In my case, I have created anAzuree storage with a name
“demostoragego”. Click on Azure CDN from the Azure Storage, as shown in below figure.
Step 3
Now, it will step into creating a new endpoint.
1. CDN profile – Name the CDN profile which contains an endpoint.
2. Pricing tier - choose the pricing tier based on your requirement; in my case, I have selected standard verizon plan.
Endpoint Name- give an end point name.
Once the CDN is created successfully, you will be notified.
Uploading a static file in Azure Storage:
Basically, I’m going to use the blob to store the static content. Click here to know how to create a blob in Azure Storage Service. In my case, I named my container as js-resource. I’m going to upload a JavaScript file into the container as a blob.
Note
While creating a container, make sure the public access level should be blob because it is a JavaScript file and I’m going to make it accessible to anonymous users as read-only.
Blob Container
File uploaded
Configuring the Azure CDN with the static content:
Open the Azure CDN(autocompletefilter) which we created and click on Load. In the load screen, mention the content path.
The path should be /<publiccontainer>/<blobname>
In my case, it is /js-resource/autocomplete.js
End Point
https://autocompletefilter.azureedge.net/js-resource/autocomplete.js
Experimenting the Azure CDN
I have created an HTML page to experiment the CDN. I removed the JS file with the local reference and added the Azure CDN as script source.
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled</title>
-
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.common.min.css">
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.rtl.min.css">
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.default.min.css">
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.117/styles/kendo.mobile.all.min.css">
-
- <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
- <script src="https://kendo.cdn.telerik.com/2018.1.117/js/angular.min.js"></script>
- <script src="https://kendo.cdn.telerik.com/2018.1.117/js/jszip.min.js"></script>
- <script src="https://kendo.cdn.telerik.com/2018.1.117/js/kendo.all.min.js"></script>
- <!--<script src="http://localhost:11207/JS/autocomplete.js"></script>-->
- <script src="https://autocompletefilter.azureedge.net/js-resource/autocomplete.js"></script> <!-- Azure CDN -->
-
- </head>
-
- <body>
- <input id="autocomplete" />
- </body>
- </html>
Result in browser
You can see from the network that the Azure CDN is successfully loaded.
I hope you have enjoyed this article. Your valuable feedback, questions, or comments about this article are always welcome.