Skip to content

Set-TenantCdnEnabled

SharePoint Online: Enables or disables CDN

#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [ValidateSet('Public','Private','Both')]
    [string]$CdnType,
    [bool]$Enable,
    [switch]$NoDefaultOrigins
)

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; NoDefaultOrigins = $NoDefaultOrigins; Enable = $Enable; CdnType = $CdnType; Confirm = $false }
        $result = Set-SPOTenantCdnEnabled @cmdArgs | Select-Object *
        if ($null -ne $result) { foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
    }
    catch { throw }
}

CDN type: Public, Private, or Both

Enable or disable the CDN

Off

Do not include default origins

An interactive directory of PowerShell scripts.