<p><img src="https://matomo.blazingcdn.com/matomo.php?idsite=1&amp;rec=1" style="border:0;" alt="">
Skip to content

Integrating Azure CDN with Storage Account

Integrating Azure CDN with a Storage Account can significantly enhance content delivery speed and reliability by strategically caching content in points of presence (PoPs) worldwide. This minimizes latency when users request content stored in an Azure Storage Account. Below is a revised and updated explanation of how to integrate Azure CDN with a Storage Account using Pulumi and TypeScript in 2024:

Step-by-step Explanation

  1. Create a Storage Account: Begin by setting up an Azure Storage Account, which provides a unique namespace to store and access your Azure Storage data objects.

  2. Create a Blob Container: Inside the Storage Account, create a blob container. This container is used to store various types of data, including documents, media files, or application installers.

  3. Create a CDN Profile: A CDN Profile is a top-level resource that encompasses CDN endpoints. It defines optimization settings and rules for content caching.

  4. Create a CDN Endpoint: The CDN endpoint serves as the interface through which end users access the content stored in your Storage Account. Ensure that the CDN endpoint is associated with the origin, which, in this case, is the Storage Account.

  5. Push Content: After configuring the integration, you can start pushing content to your Blob Container. This content will become accessible via the CDN endpoint.

Below is the code snippet that showcases the Pulumi program, enabling seamless integration of Azure CDN with a Storage Account using TypeScript.

import * as pulumi from "@pulumi/pulumi";
import * as storage from "@pulumi/azure-native/storage";
import * as cdn from "@pulumi/azure-native/cdn";
import * as resource from "@pulumi/azure-native/resources";

// Step 1: Create an Azure Resource Group
const resourceGroup = new resource.ResourceGroup("resourceGroup");

// Step 2: Create a Storage Account
const storageAccount = new storage.StorageAccount("storageaccount", {
resourceGroupName: resourceGroup.name,
sku: { name: storage.SkuName.Standard_LRS }, // Using standard locally redundant storage
kind: storage.Kind.StorageV2, // General purpose v2 account
location: resourceGroup.location,

// Step 3: Create a Blob Container in the Storage Account
const blobContainer = new storage.BlobContainer("blobcontainer", {
resourceGroupName: resourceGroup.name,
accountName: storageAccount.name,
publicAccess: storage.PublicAccess.None, // No public access

// Step 4: Create a CDN Profile
const cdnProfile = new cdn.Profile("cdnprofile", {
resourceGroupName: resourceGroup.name,
sku: {
name: cdn.SkuName.Standard_Microsoft,

// Step 5: Create a CDN Endpoint associated with the Storage Account
const cdnEndpoint = new cdn.Endpoint("cdnendpoint", {
resourceGroupName: resourceGroup.name,
profileName: cdnProfile.name,
location: resourceGroup.location,
originHostHeader: storageAccount.primaryEndpoints.web, // This is the Storage Account's primary web endpoint
origins: [
name: "cdnorigin", // Name of the origin
hostName: storageAccount.primaryEndpoints.web.replace("https://", "").replace("/", ""), // Hostname of the origin
isHttpsAllowed: true,
isHttpAllowed: false,
optimizationType: cdn.OptimizationType.GeneralWebDelivery,

// Export the primary endpoints of the Storage Account and the CDN Endpoint's hostname
export const storageAccountPrimaryEndpoints = storageAccount.primaryEndpoints;
export const cdnEndpointHostname = cdnEndpoint.hostName;

This program sets up all the necessary Azure resources for integrating Azure CDN with an Azure Storage Account. Each code block corresponds to a specific step:

  • Resource Group: Creates a new resource group to organize all Azure resources.

  • Storage Account: Provisions a new storage account with the Standard_LRS SKU, which is locally redundant storage, and a general-purpose v2 account type, recommended for most scenarios.

  • Blob Container: Creates a blob container within the storage account with no public access to ensure that blobs can only be accessed by authorized clients.

  • CDN Profile: Establishes a new CDN profile using the Standard Microsoft SKU, a cost-effective CDN solution provided by Azure.

  • CDN Endpoint: Sets up a CDN endpoint associated with the Storage Account origin. The endpoint is configured to allow HTTPS traffic.

The program then exports the primary endpoints of the Storage Account and the CDN Endpoint's hostname for validation and ease of access.

Running this Pulumi program with pulumi up will provision the Azure resources needed for integrating Azure CDN with a Storage Account. Once set up and content is uploaded to the blob container, it will be cached at CDN endpoints, providing users with improved latency when accessing your content.