CDN

Enable CDN

Enabling the Content Delivery Network (CDN) in SharePoint Framework (SPFx) can significantly improve the performance of your SharePoint Online pages by caching static assets closer to the users. Here’s a step-by-step guide to enable the Microsoft 365 CDN for your SPFx solutions:

  1. Connect to SharePoint Online:
    • Open the SharePoint Online Management Shell and connect to your SharePoint Online tenant using the following command: Connect-SPOService -Url https://your-tenant-admin.sharepoint.com
  2. Enable the Public CDN:
    • Run the following command to enable the public CDN: Set-SPOTenantCdnEnabled -CdnType Public
  3. Add Origins to the CDN:
    • Specify the origins (libraries) that should be included in the CDN. For example:Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl */sites/CDNLibrary
  4. Verify CDN Settings:
    • Check the status of your CDN settings with these commands:
      • Get-SPOTenantCdnEnabled -CdnType Public
      • Get-SPOTenantCdnOrigins -CdnType Public
      • Get-SPOTenantCdnPolicies -CdnType Public

Disable CDN

To disable the Content Delivery Network (CDN) for your SharePoint Framework (SPFx) solutions, you can use the following steps:

  1. Connect to SharePoint Online:
    • Open the SharePoint Online Management Shell and connect to your SharePoint Online tenant: Connect-SPOService -Url https://your-tenant-admin.sharepoint.com
  2. Disable the Public CDN:
    • Run the following command to disable the public CDN: Set-SPOTenantCdnEnabled -CdnType Public -Enable $false
  3. Remove CDN Origins:
    • If you have specific origins set up for the CDN, you can remove them using: Remove-SPOTenantCdnOrigin -CdnType Public -OriginUrl */sites/CDNLibrary
  4. Verify CDN Settings:
    • Check the status of your CDN settings to ensure they are disabled:
      • Get-SPOTenantCdnEnabled -CdnType Public
      • Get-SPOTenantCdnOrigins -CdnType Public

Leave a Reply

Your email address will not be published. Required fields are marked *