Skip to content

Add-TenantCdnOrigin

SharePoint Online: Adds a CDN origin to the tenant

#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 }
        $result = Add-SPOTenantCdnOrigin @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 or Private

Path to the document library to configure, e.g. /sites/site/subfolder

An interactive directory of PowerShell scripts.