Skip to content

Remove-TenantCdnOrigin

SharePoint Online: Removes a CDN origin

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

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [ValidateSet('Public','Private')]
    [string]$CdnType,
    [Parameter(Mandatory = $true)]
    [string]$OriginUrl
)

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; OriginUrl = $OriginUrl; CdnType = $CdnType; Confirm = $false }
        Remove-SPOTenantCdnOrigin @cmdArgs | Out-Null
        [PSCustomObject]@{ Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"; Status = "Success"; Message = "CDN origin '$OriginUrl' removed from '$CdnType'" }
    }
    catch { throw }
}

CDN type: Public or Private

Path to the document library to remove from CDN

An interactive directory of PowerShell scripts.