Office 365 CDN - Preview vs General Availability

Office 365 CDN which provides a way to configure a SharePoint Document Library as a CDN is now Generally Available.

The preview was released few months back and if customers already using it while in Preview must know that the PowerShell commands and the way this works has changed a lot in General Availability. With GA, we now have a public CDN and a private CDN. Note that Private CDN is in Preview.

The main point to note is that the CDN URL generator /_vti_bin/publiccdn.ashx is not working anymore. This essentially means do not use it, update your URLs with the GA api.

Preview vs General Availability


General Availability

Enable CDN (Tenant level setting) Set-SPOTenant -PublicCdnEnabled $true  #NOTE: Public CDN is GA. Private CDN is in preview.Set-SPOTenantCdnEnabled -CdnType Public   #-NoDefaultOriginsSet-SPOTenantCdnEnabled -CdnType Private #-NoDefaultOrigins#Alternatively enable both using below cmdlet#Set-SPOTenantCdnEnabled -CdnType Both
Verify CDN Enabled Get-SPOTenant | FL *cdn*  Get-SPOTenantCdnEnabled -CdnType PublicGet-SPOTenantCdnEnabled -CdnType Private
Get CDN Policies Get-SPOTenant | Select PublicCdnAllowedFileTypes  Get-SPOTenantCdnPolicies -CdnType PrivateGet-SPOTenantCdnPolicies -CdnType Public
Set CDN Policy Set-SPOTenant -PublicCdnAllowedFileTypes "CSS,EOT,GIF,ICO,JPEG,JPG,JS,MAP,PNG,TXT"  Set-SPOTenantCdnPolicy -PolicyType {IncludeFileExtensions | ExcludeRestrictedSiteClassifications | ExcludeIfNoScriptDisabled}-PolicyValue <string> -CdnType{Public | Private}
New CDN Origin New-SPOPublicCdnOrigin -Url ""  Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/dev/cdnlibAdd-SPOTenantCdnOrigin -CdnType Private -OriginUrl sites/pub/cdnlibAdd-SPOTenantCdnOrigin -CdnType Public -OriginUrl */imageassetsAdd-SPOTenantCdnOrigin -CdnType Public -OriginUrl */photos
Get CDN Origins Get-SPOPublicCdnOrigins  Get-SPOTenantCdnOrigins -CdnType PublicGet-SPOTenantCdnOrigins -CdnType Private
Remove CDN Origins Remove-SPOPublicCdnOrigin -Identity 193700617159…  Remove-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/dev/cdnlibRemove-SPOTenantCdnOrigin -CdnType Private -OriginUrl sites/pub/cdnlib
CDN Url Structure<tenant host name>/<ID of the public CDN origin>/<sub-path under the origin> E.g: /159..e352d/jigsaw.jpg<tenant host name>/sites/site/libraryE.g: “ &_oat_=1495567990_de85e8d775578ba993690038577140247188eb5a69c7855ffffb89d5f8525519”  
Generate CDN Url This CDN Url generator is not working anymore since the GA. I am assuming this is to discourage using the Preview api. I will update this as I learn more about it.See Vesa's note here. 
CDN URL Validation in Fiddler Add header “Referer:” to the GET request
Auto-Rewrite of URls Not Applicable Only in GA



Get-SPOTenantCdnEnabled -CdnType Public

Get-SPOTenantCdnEnabled -CdnType Private

Set-SPOTenantCdnEnabled -CdnType Public  #-NoDefaultOrigins

Set-SPOTenantCdnEnabled -CdnType Private #-NoDefaultOrigins

#Set-SPOTenantCdnEnabled -CdnType Both


Get-SPOTenantCdnPolicies -CdnType Public

Get-SPOTenantCdnPolicies -CdnType Private

Set-SPOTenantCdnPolicy -PolicyType {IncludeFileExtensions | ExcludeRestrictedSiteClassifications | ExcludeIfNoScriptDisabled} -PolicyValue <string> -CdnType

    {Public | Private}


Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/dev/cdnrepo

Add-SPOTenantCdnOrigin -CdnType Private -OriginUrl sites/pub/cdnlib

Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl */imageassets

Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl */photos


Get-SPOTenantCdnOrigins -CdnType Public

Get-SPOTenantCdnOrigins -CdnType Private


Remove-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/dev/cdnlib

Remove-SPOTenantCdnOrigin -CdnType Private -OriginUrl sites/pub/cdnlib

 Set-SPOTenantCdnEnabled -CdnType Both -Enable $false


URL FORMAT:<tenant host name>/sites/site/library

###PREVIEW API########

Get-SPOTenant | FL *cdn*

Set-SPOTenant -PublicCdnEnabled $true

Get-SPOTenant | Select PublicCdnAllowedFileTypes


New-SPOPublicCdnOrigin -Url ""


Remove-SPOPublicCdnOrigin -Identity 1937006161eeae8fe7159…


URL FORMAT:<tenant host name>/<ID of the public CDN origin>/<sub-path under the origin>

How does image renditions work in combination with the Office 365 CDN:

SharePoint Online and 2013/2016, it supports image renditions. Image renditions are configured using the Site Settings > Look & Feel > Image Renditions page. Example entry:

RenditionID: 8, Width: 200, Height: 400

Image renditions are used by appending the renditionid to the image url.

For example:

This same approach is not supported with the images in a CDN enabled library. That means if you append RenditionID to CDN url (example:, its not honored.

Image Renditions for CDN images can be achieved much more easily by just appending the width and height to the CDN Url. Example:\&width=100\&cropMode=fit

  • Image rendition support for images from the CDN can be enabled with height and width query parameters in the URL
    • Note. both height and width parameters are required for the renditions to work
    • You can also control the cropMode for the images with cropMode query parameter with following options: fit, fill, top and bottom (fit is default value).
  • You can use renditions with query parameters for the image URL