-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCDNscript.ps1
30 lines (23 loc) · 1.18 KB
/
CDNscript.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Connect to your tenant
Connect-SPOService https://*****-admin.sharepoint.com
#Check the current status of the CDN capability - by default disabled
Get-SPOTenantCdnEnabled -CdnType Public
Get-SPOTenantCdnEnabled -CdnType Private
#Enable CDN using default settings - -NoDefaultOrigins a optional parameter
Set-SPOTenantCdnEnabled -CdnType Public
Set-SPOTenantCdnEnabled -CdnType Private
#Get CDN policies
Get-SPOTenantCdnPolicies -CdnType Public #specifically desgined for Sharepoint online and sharpeoint online pages
Get-SPOTenantCdnPolicies -CdnType Private
#Get CDN origins
Get-SPOTenantCdnOrigins -CdnType Public
Get-SPOTenantCdnOrigins -CdnType Private
#Add CDN origins
Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/Teamsitedemo/cdn
Add-SPOTenantCdnOrigin -CdnType Private -OriginUrl sites/Teamsitedemo/assets
#Remove CDN origins
Remove-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/Teamsitedemo/cdn #caching will be for 30 days
Remove-SPOTenantCdnOrigin -CdnType Private -OriginUrl sites/Teamsitedemo/assets #caching will be for 1 hr
#Disable CDN using default settings
Set-SPOTenantCdnEnabled -CdnType Public -Enable $false
Set-SPOTenantCdnEnabled -CdnType Private -Enable $false