Search code examples
powershellsharepointcdnsharepoint-online

Disable CDN through PowerShell


I built a React Typescript project in SharePoint.

I'm currently getting errors with how the CDN is serving up the content.

I want to disable CDN all together across all tenants.

Right now when I run:

Get-SPOTenantCdnEnabled -CdnType Public

I get back True

I just want a way to disable CDN. I found this article here but I'm having trouble with the command: https://learn.microsoft.com/en-us/powershell/module/sharepoint-online/remove-spotenantcdnorigin?view=sharepoint-ps

Remove-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/pubsite/siteassets/subfolder

I'm just not too sure what to put in the sites/pubsite/siteassets/subfolder section.

So all I'm trying to do is disable CDN on all tenants, I was following a tutorial and accidentally turned it on.


Solution

  • If you just want to disable the CDN option for a tenant without modifying the defined CDN providers, use Set-SPOTenantCdnEnabled:

    Set-SPOTenantCdnEnabled -CdnType Both -Enable:$false