Skip to main content

Disable specified Tenant-wide Extension

Author: Shantha Kumar T

Tenant Wide Extensions list from the App Catalog helps to manage the activation / deactivation of the tenant wide extensions. The below sample script helps to disable the specified tenant wide extension based on the id parameter.

Note: TenantWideExtensionDisabled column denotes the extension is enabled or disabled.

$extensionName = Read-Host "Enter the Extension Name"
$listName = "Tenant Wide Extensions"

$appCatalogUrl = m365 spo tenant appcatalogurl get
$filterQuery = "Title eq '" + $extensionName + "'"
$appItems = m365 spo listitem list --listTitle $listName --webUrl $appCatalogUrl --fields "Id,Title" --filter $filterQuery --output json
$extItems = $appItems.Replace("Id", "ExtId") | ConvertFrom-JSON

if ($extItems.count -gt 0) {
m365 spo listitem set --listTitle $listName --id $extItems.ExtId --webUrl $appCatalogUrl --TenantWideExtensionDisabled "true" >$null 2>&1
Write-Host("Extension disabled.");
else {
Write-Host("No extensions found with the name '" + $extensionName + "'.");