Collaborate, Innovate, Automate

Delete Term Group

This PnP PowerShell script safely removes a term group and all of its associated term sets from the SharePoint Online term store. It is designed for taxonomy cleanup scenarios — whether you are retiring an outdated classification structure, reorganising your managed metadata, or removing a term group created during testing.

Purpose

Managing the term store over time means dealing with redundant or obsolete groups. This script helps you:

Prerequisites

PowerShell Script

#Config Variables
$AdminCenterURL = "https://tenantName-admin.sharepoint.com"
$ClientId = "" #Your tenant Client ID

$TermGroupName = ""
 
# ── Connect ──────────────────────────────────────────────────
Connect-PnPOnline -Url $AdminCenterURL -Interactive -ClientId $ClientId

# ── Resolve group name if not set ────────────────────────────
if (-not $TermGroupName) {
    $TermGroupName = Read-Host "Enter the term group name to delete"
}
 
# ── Delete ────────────────────────────────────────────────────
Remove-PnPTermGroup -Identity $TermGroupName
 
# ── Disconnect ────────────────────────────────────────────────
Disconnect-PnPOnline
Write-Host "Done." -ForegroundColor Cyan

Usage Notes