The below content is presented so you can quicly understand Office365 CDN and execute the related commands and start enjoying the benefits of the CDN feature in your SharePoint Online environment.
Problem
There are a couple of problems if third party libraries such as moment.js, datatable.js, lodash.js, ag-grid.js and many more are used. These libraries are maintained in each site collection because there are different sets of users and permissions granted only to respective departments. With permission restriction, it is not possible to share the files across site collections.
Approaches
- Separate site collection can be provisioned and common libraries can be accesed and maintained.
- Buy an Azure CDN storage and maintain common assets - extra cost to maintain.
- In-built SharePoint Online CDN which was proposed by Microsoft and current available in SharePoint Online environment.
Since SharePoint Online CDN (Office365 CDN) is currently avaible, I have complied the list of features and PowerShell commands to start enjoying :)
Feature
|
Public
|
Private
|
Default folders
|
*/MASTERPAGE
*/STYLE LIBRARY
|
*/USERPHOTO.aspx
*/SITEASSETS
|
Deleted files are accessible up to
|
30 days
|
1 hour
|
Can CDN be consumed from outside SharePoint?
|
No
|
No
|
Default File Types
|
.css, .eot, .gif, .ico, .jpeg, .jpg, .js, .map, .png, .svg, .ttf, and .woff
|
.gif, .ico, .jpeg, .jpg, .js, and .png
|
Files render from
|
https://privatecdn.sharepointonline.com
/<<tenantname.sharepoint.com>>
/sites/<<sitename>>
/<<libraryname>>/<<item>>
|
https://public.sharepointonline.com
/<<tenantname.sharepoint.com>>
/sites/<<sitename>>
/<<libraryname>>/<<item>>?xxxxxx
|
Once files are published to library, how soon can assets be accessed ?
|
15 Min
|
15 Min
|
Is there any cost to use Office365 CDN?
|
No
|
No
|
Connect SharePoint Online from PowerShell Window
- $adminUPN="<the full email address of a SharePoint Online global administrator account, example: [email protected]>"
- $orgName="<name of your Office 365 organization, example: srinivasnarula>"
- $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
- Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
Get status of private CDN
- Get-SPOTenantCdnEnabled -CdnType private
Enable private CDN in tenant
- Set-SPOTenantCdnEnabled -CdnType private
Add new private CDN Origin
- Add-SPOTenantCdnOrigin -CdnType private -OriginUrl sites/<<SiteName>>/<<LibraryName>>
Remove private CDN Origins
- Remove-SPOTenantCdnOrigin -CdnType private -OriginUrl sites/<<SiteName>>/<<LibraryName>>
List all private CDN Origins
- Get-SPOTenantCdnOrigins -CdnType private
Disable private DN Origin
- Set-SPOTenantCdnEnabled -CdnType private -Enable $false
To use the public CDN, replace private with public keywords in the above commands.