Please read through my previous article, Develop First Client-Side Web Part to get started, develop your first SPFx client-side web part, and test it on a local SharePoint workbench. In real-life scenarios, we will have to deploy these SPFx web parts to some hosting environments from where it can be served to SharePoint.
Below are the most commonly followed deployment approaches
- Azure CDN (Previous article)
- Office 365 Public CDN (This article)
- SharePoint Library in your tenant
In this article, we will explore how SPFx web parts can be deployed to office 365 CDN.
Configure CDN in Office 365 Tenant
Any of the document libraries in the SharePoint Online tenant can be promoted as a CDN, which will help to serve the JS files for SPFx client web parts hosted in SharePoint. This CDN location, being public, can be accessed easily.
Any of the document libraries in the SharePoint Online tenant can be promoted as a CDN, which will help to serve the JS files for SPFx client web parts hosted in SharePoint. This CDN location, being public, can be accessed easily.
To configure the CDN in Office 365 follow the below steps,
- Download and install the latest version of SharePoint Online Management Shell from https://www.microsoft.com/en-us/download/details.aspx?id=35588
- Open the SharePoint Online Management Shell
- Connect to SharePoint Online tenant using below cmdletReplace [tenant] with your actual tenant name
- Connect-SPOService -Url https://[tenant]-admin.sharepoint.com
- Run below set of commands to review the existing Office 365 public CDN settings on your tenant
- Get-SPOTenantCdnEnabled -CdnType Public
This command will return the status of CDN. True if CDN is enabled, false otherwise.
- Get-SPOTenantCdnOrigins -CdnType Public
This command will return the location of already configured CDN origins. The URLs are relative. In the first instance, it will not return any values as CDN is not yet set up.
- Get-SPOTenantCdnPolicies -CdnType Public
This command will return the policy settings for CDN
Run below command to enable the CDN
- Set-SPOTenantCdnEnabled -CdnType Public

After enabling the CDN, */CLIENTSIDEASSETS origin is by default added as a valid origin. By default allowed file extensions are: CSS, EOT, GIF, ICO, JPEG, JPG, JS, MAP, PNG, SVG, TTF, and WOFF.
The configuration takes up to 15 to 20 minutes.
To check the current status of CDN endpoints, run below command
- Get-SPOTenantCdnOrigins -CdnType Public




Piyush AgarwalPosted Oct 5, 2018, 12:00 PM
Nice Article....could you please elaborate in what scenarios do we use this... Thanks