Content Delivery Network (CDN)
CDN’s help keep Office 365 fast and reliable for end users by caching cache static assets closer to the browsers requesting them to speed up downloads and reduce perceived end user latency.
Note: The Office 365 CDN is not the same as the Azure CDN.
Office 365 CDN
Office 365 includes a native CDN feature that is included as part of the SharePoint Online subscription. Office 365 CDN uses the HTTP/2 protocol for improved compression and download speeds.
The feature provides support for both Private and Public CDN.
- Users who already have permission to access to the folder or library designated by the origin will automatically be granted tokens.
- SharePoint Online does not support item-level permissions for the CDN.
Figure 1: Logical Illustration of Private CDN (Courtesy: Microsoft)
#Adds specified Origin Url of the SPO Tenant to the CDN Add-SPOTenantCdnOrigin -CdnType Private -OriginUrl */CLIENTSIDEASSETS Add-SPOTenantCdnOrigin -CdnType Private -OriginUrl */MASTERPAGE Add-SPOTenantCdnOrigin -CdnType Private -OriginUrl '*/STYLE LIBRARY'
Script 3: PowerShell cmdlet for enabling private CDN on the specified Origin Url
download generic resource assets like the Office 365 client applications from a public origin.
Figure 2: Logical Illustration of Public CDN (Courtesy: Microsoft)
#Adds specified Origin Url of the SPO Tenant to the CDN Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl */CLIENTSIDEASSETS Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl */MASTERPAGE Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl '*/STYLE LIBRARY'
Script 4: PowerShell cmdlet for enabling public CDN on the specified Origin Url
Planning for Office 365 CDN
The PowerShell cmdlets to enable CDN on the tenant is provided below
#Needs to be an admin site Connect-SPOService -Url <Tenant SharePoint Admin URL> #Enable Office 365 Private CDN in the tenant Set-SPOTenantCdnEnabled -CdnType Private -Enable $true #Enable Office 365 Public CDN in the tenant Set-SPOTenantCdnEnabled -CdnType Public -Enable $true #Enable both Office 365 Public and Private CDN in the tenant Set-SPOTenantCdnEnabled -CdnType Both -Enable $true #If either Azure CDN or a custom third party CDN is used Set-SPOTenantCdnEnabled -CdnType Both -Enable $true -NoDefaultOrigins
Script 1: PowerShell cmdlet for enabling private CDN on a tenant
Note: The system takes about 30 minutes to synchronize the configuration across the data-center. During this time status will be “Configuration pending” which is expected as the SharePoint Online tenant connects to the CDN service.
Office 365 CDN provides IT administrators a high level of flexibility in specifying which content is hosted in the CDN by specifying origin URL. The origin URL can point to either a SharePoint library or folder. The assets stored in the library or folder will be synced to the CDN hosts. In addition, Admins have the flexibility to specify the file types to be included in CDN. In addition, Admins have the flexibility to specify the file types to be included in CDN.
#Set the file types to be included in the CDN Set-SPOTenantCdnPolicy -CdnType Public -PolicyType IncludeFileExtensions -PolicyValue "CSS, GIF,ICO,JPEG,JPG,JS" #Sets the CDN to a Public type except for the site classifications included in the exclusion list Set-SPOTenantCdnPolicy -CdnType Public -PolicyType ExcludeRestrictedSiteClassifications -PolicyValue "Confidential,Restricted"
Script 2: PowerShell cmdlet for setting granular configuration settings
Note: It’s not possible to modify an existing CDN origin. Instead, an existing CDN origin can be modified by first removing the previously defined CDN origin using the Remove-SPOTenantCdnOrigin cmdlet and add a new one using the Add-SPOTenantCdnOrigin cmdlet.