Configuring a SharePoint Online CDN

First, we need to provide a folder for our asset files. This is a special library that will typically be hosted on Microsoft Azure datacenter infrastructure or a similar globally available infrastructure.

  1. Start by finding your Site Assets document library in the SharePoint Online site you wish to use. The usual address is https://{tenant}.sharepoint.com/sites/{your-site}/Site Assets/.

 

  1. Create a new folder named cdn in this document library:
  1. Now, we need to tell SharePoint Online that this particular folder in this particular document library should be enabled for CDN purposes. As CDN carries some additional infrastructure changes on Office 365, we need to instruct SharePoint Online via PowerShell to enable CDN functionality.
  2. For this task, we will need the SharePoint Online Management Shell, which is a PowerShell-enabled shell for configuring SharePoint Online. Start by downloading the package from https://www.microsoft.com/en-us/download/details.aspx?id=35588, and running through the installation wizard.
  3. After installing the package, you can search for SharePoint in your start menu to find a shortcut to the tool:
  1. Next, we need to authenticate against SharePoint Online in order to start configuring our CDN. Start by capturing your credentials in a variable with the following PowerShell command: $credentials = get-credential.
  2. Enter your email address and password for an account that has SharePoint Admin privileges:
  1. Next, Connect with SharePoint Online with the following command:
Connect-SPOService -Url https://{tenant}-admin.sharepoint.com -Credential $credentials

And just like before, replace {tenant} with your Office 365 tenant name, such as CompanyA. Now, query the SPO Tenant settings whether or not Public CDN endpoints are enabled:

Get-SPOTenant | select PublicCdnEnabled

This should return a value of true.

  1. Next, query the SPO Tenant settings for which file types are allowed within the CDN: Get-SPOTenant | select PublicCdnAllowedFileTypes . This should produce a list with the following values: CSS, EOT, GIF, ICO, JPEG, JPG, JS, MAP, PNG, SVG, TTF, WOFF, TXT. If the listing is incomplete or empty, update the settings with the following command:
Set-SPOTenant -PublicCdnAllowedFileTypes "CSS,EOT,GIF,ICO,JPEG,JPG,JS,MAP,PNG,SVG,TTF,WOFF,TXT"

Then make sure the values are updated by querying again with Get-SPOTenant.

  1. Finally, we'll add a new CDN endpoint that points to our cdn folder that we created earlier:
New-SPOPublicCdnOrigin -Url https://{tenant}.sharepoint.com/sites/{site}/SiteAssets/cdn
  1. This produces a warning that all files stored in the CDN will be anonymously accessible. For us, this is fine but it's a good thing to keep in mind when implementing functionality that needs to be secured.
  2. And lastly, query for the CDN endpoint to make sure it was configured successfully.
    Get-SPOPublicCdnOrigins | Format-List

Format-List produces a more readable list for us. The output should resemble the following listing:

Id : 13200052f97a4dd249b6768527c2d4bf49dfb4dbec0eff57a88a7ef9dfede4d01883a44

Url : HTTPS://TENANT.SHAREPOINT.COM/SITES/SITE/SITEASSETS.

Id : 12390061f758b807354244dd12e9808aba5c97058384a46b61b43861da5e600492d2947

Url : HTTPS://TENANT.SHAREPOINT.COM/SITES/SITE2/SITEASSETS/CDN.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.33.87