FunctionsPublic/Remove-GraphPage.ps1

<#
.SYNOPSIS
Removes the specified SharePoint Page
 
.DESCRIPTION
Removes the specified page from the specified SharePoint site
 
.PARAMETER accessToken
A Microsoft Graph API access token with the required permissions
 
.PARAMETER sharePointSiteID
The SharePoint site that should be deleted
 
.PARAMETER sharePointPageID
The SharePoint page that should be deleted
#>

function Remove-GraphPage
{
    param(
        [parameter(Mandatory=$true)][psobject]$accessToken, 
        [parameter(Mandatory=$true)][string]$sharePointSiteID, 
        [parameter(Mandatory=$true)][string]$sharePointPageID
    )

    $responseBody = Invoke-RestMethod `
        -Uri "https://graph.microsoft.com/beta/sites/$($sharePointSiteID)/pages/$($sharePointPageID)" `
        -Headers @{"Authorization" = "Bearer $($accessToken.AccessTokenCredential.GetNetworkCredential().password)"} `
        -ContentType "application/json" `
        -Method DELETE
    
    if($null -eq $responseBody)
    {
        return $null
    }
    else
    {
        return $responseBody.value
    }
}