Setting up the Office 365 Public CDN in SharePoint Online

If you’re looking to set up the Office 365 Public CDN in SharePoint Online, you can use the following PowerShell scripts.  I installed the June 2017 Release of the SharePointPnP.PowerShell Commands for this post.

After you run the script, your changes will take affect within 15 minutes.  The files stored in the CDN can only be accessed within the context of SharePoint so if you try to browse to the CDN url for your asset, it will not work; however, if you reference the same url in SharePoint, it will work.

The CDN url will look like:

$spo = Read-Host 'Enter your SPO Service URL. (example https://<tenant>'
$origin = Read-Host 'Enter the url to the CDN.  (example https://<tenant>'

connect-sposervice $spo
$tenant = Get-SPOTenant

Set-SPOTenant -PublicCdnEnabled $true

$tenant = Get-SPOTenant
Write-host 'Public Cnd Enabled = ' $tenant.PublicCdnEnabled 

Write-host 'Allowed File Types = ' $t.PublicCdnAllowedFileTypes

New-SPOPublicCdnOrigin -url $origin

If you need to get the Origin ID, you can find it with the following script.

$tenant = Get-SPOTenant

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s