M365 Admin Handbook — Chapter 9: Microsoft Teams, SharePoint Online & OneDrive Administration (Preventing Sprawl)

📚 Mastering Microsoft 365 & Endpoint Administration Chapter 9 of 14
View Full Book TOC →
📘 Chapter 9 Executive Brief — Stopping Teams, SharePoint & OneDrive Sprawl
  • Every Team Creates a Site: In Microsoft 365, creating a Team provisions an Entra Microsoft 365 Group, an Exchange Group Mailbox, and a SharePoint Online team site. Unrestricted self-service creation is the #1 cause of tenant sprawl and Copilot oversharing.
  • Three Core Guardrails: (1) Restrict M365 Group creation via Group.Unified (EnableGroupCreation = false + GroupCreationAllowedGroupId), (2) enforce a Group Expiration Policy (groupLifecyclePolicies), and (3) lock down SharePoint external sharing & EEEU (Everyone Except External Users).
  • OneDrive Offboarding: Configure OneDrive retention for departed users (30–3650 days) and assign manager secondary ownership before Entra account deletion triggers automatic cleanup.

In Chapter 8, we secured endpoints with Intune Win32 apps, Defender for Endpoint, and Remediation scripts. Now we move to the collaboration layer—Microsoft Teams, SharePoint Online, and OneDrive for Business—where uncontrolled self-service creation quickly turns into thousands of orphaned sites, broken permissions, and bloated SharePoint storage overages.


1. Architecture: How M365 Groups, Teams, SharePoint & OneDrive Connect

1. Creation Gate Group.Unified Setting EnableGroupCreation: false Allowed Security Group Naming Prefix Policy 2. Provisioned Assets • Microsoft Team + Channels • SharePoint Team Site • Exchange Group Mailbox 1 Group = 3 Workloads 3. Sharing & Storage • Site Sharing Cap • Disable EEEU Auto-Add • File Version Limits SAM / RAC Scoping 4. Lifecycle ✔ 180d Expiration ✔ Auto-Renewal ✔ 2+ Owners Rule Zero Orphan Sites Licensing Note: Restricting M365 Group Creation & Group Expiration Policies require Microsoft Entra ID P1 or P2. If you deploy Microsoft 365 Copilot, sprawl directly increases oversharing risk—lock down creation and EEEU before enabling Copilot.

2. Live-Tested Audit: Group Creation, Lifecycle & Ownerless Teams (Graph PowerShell)

Before changing tenant settings, audit your current Group.Unified creation policy, groupLifecyclePolicies, and any Microsoft 365 Groups or Teams that have fewer than 2 owners.

POWERSHELL
#Requires -Modules Microsoft.Graph.Authentication
<#
.SYNOPSIS
    Audits Microsoft 365 Group creation restrictions, Group Expiration Policies,
    and ownerless Teams / M365 Groups via Microsoft Graph REST.
#>
param(
    [string]$ClientId,
    [string]$TenantId,
    [string]$CertificateThumbprint
)

if ($ClientId -and $TenantId -and $CertificateThumbprint) {
    Connect-MgGraph -ClientId $ClientId -TenantId $TenantId -CertificateThumbprint $CertificateThumbprint -NoWelcome
} else {
    Connect-MgGraph -Scopes "Directory.Read.All", "Group.Read.All" -NoWelcome
}

Write-Host "[1/3] Checking Group.Unified Creation Restrictions..." -ForegroundColor Cyan
$GroupSettings = (Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/groupSettings" -OutputType PSObject).value
$Unified = $GroupSettings | Where-Object { $_.templateId -eq "62375ab9-6b52-47ed-826b-58e47e0e304b" }
if ($Unified) {
    $Unified.values | Where-Object { $_.name -in @('EnableGroupCreation', 'GroupCreationAllowedGroupId') } | Format-Table name, value -AutoSize
} else {
    Write-Warning "No Group.Unified tenant setting configured — all users can currently create M365 Groups and Teams."
}

Write-Host "[2/3] Checking Group Expiration Policies..." -ForegroundColor Cyan
$Lifecycle = (Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/groupLifecyclePolicies" -OutputType PSObject).value
if ($Lifecycle) {
    $Lifecycle | Select-Object id, groupLifetimeInDays, managedGroupTypes, alternateNotificationEmails | Format-Table -AutoSize
} else {
    Write-Warning "No Group Expiration Policy configured."
}

Write-Host "[3/3] Auditing Teams for Ownerless / Single-Owner Risk..." -ForegroundColor Cyan
$Teams = (Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/groups?`$filter=resourceProvisioningOptions/Any(x:x eq 'Team')&`$select=id,displayName,visibility,createdDateTime" -OutputType PSObject).value
$OwnerReport = foreach ($t in $Teams) {
    $owners = (Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/groups/$($t.id)/owners?`$select=id,displayName,userPrincipalName" -OutputType PSObject).value
    [PSCustomObject]@{
        TeamName    = $t.displayName
        Visibility  = $t.visibility
        OwnerCount  = @($owners).Count
        Owners      = ($owners.userPrincipalName -join "; ")
        AtRisk      = (@($owners).Count -lt 2)
    }
}
$OwnerReport | Format-Table -AutoSize

Live Output from LAB 365 (xzf58.onmicrosoft.com):

TEXT
name                        value
----                        -----
GroupCreationAllowedGroupId
EnableGroupCreation         true

groupLifetimeInDays managedGroupTypes alternateNotificationEmails
------------------- ----------------- ---------------------------
                 30 All               [email protected];[email protected]

Notice that EnableGroupCreation is true with an empty GroupCreationAllowedGroupId—meaning any licensed user can still create new Teams/Groups.


3. Restricting Self-Service Teams & M365 Group Creation

To restrict creation to an approved security group (e.g., SG-M365-Group-Creators), update or create the Group.Unified directory setting via Graph:

POWERSHELL
# Require Directory.ReadWrite.All
$AllowedGroupId = "<ObjectId-of-SG-M365-Group-Creators>"
$Body = @{
    templateId = "62375ab9-6b52-47ed-826b-58e47e0e304b"
    values     = @(
        @{ name = "EnableGroupCreation"; value = "false" },
        @{ name = "GroupCreationAllowedGroupId"; value = $AllowedGroupId }
    )
} | ConvertTo-Json -Depth 4

# If Group.Unified already exists, PATCH /v1.0/groupSettings/{id}; otherwise POST /v1.0/groupSettings
$Existing = (Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/groupSettings" -OutputType PSObject).value |
    Where-Object { $_.templateId -eq "62375ab9-6b52-47ed-826b-58e47e0e304b" }

if ($Existing) {
    Invoke-MgGraphRequest -Method PATCH -Uri "https://graph.microsoft.com/v1.0/groupSettings/$($Existing.id)" -Body $Body
} else {
    Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/v1.0/groupSettings" -Body $Body
}

(For a deep-dive on user-specific restrictions and restoring accidentally deleted Teams, see our dedicated Restrict Group Creation and Restore Deleted M365 Groups & Teams guides.)


4. SharePoint Online & OneDrive Sprawl Controls

Use the Microsoft.Online.SharePoint.PowerShell module (Connect-SPOService) to enforce tenant-wide guardrails that prevent oversharing and runaway version storage:

POWERSHELL
#Requires -Modules Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com"

# 1. Disable automatic "Everyone except external users" (EEEU) claims on new sites
Set-SPOTenant -ShowEveryoneExceptExternalUsersClaim $false

# 2. Restrict external sharing to authenticated guests only (block anonymous Anyone links)
Set-SPOTenant -SharingCapability ExternalUserSharingOnly

# 3. Set default sharing link to Specific People (PeopleInYourOrganization or Direct) and View-only
Set-SPOTenant -DefaultSharingLinkType Direct
Set-SPOTenant -DefaultLinkPermission View

# 4. Cap OneDrive storage per user & set departed-user retention (e.g., 180 days)
Set-SPOTenant -OneDriveStorageQuota 1048576   # 1 TB in MB
Set-SPOTenant -OrphanedPersonalSitesRetentionPeriod 180

# 5. Audit top 10 largest SharePoint sites consuming tenant pooled storage
Get-SPOSite -Limit All | Sort-Object StorageUsageCurrent -Descending |
    Select-Object -First 10 Title, Url, StorageUsageCurrent, StorageQuota, SharingCapability |
    Format-Table -AutoSize

Key SharePoint & OneDrive Sprawl Checklist

  1. Version History Limits: Enable automatic or intelligent file version limits in the SharePoint admin center so 500 auto-saved PowerPoint drafts don't consume 50× the file's size.
  2. SharePoint Advanced Management (SAM): If licensed (or included with M365 Copilot), turn on Restricted Access Control (RAC) for HR/Finance/Executive sites and run Data Access Governance (DAG) reports weekly.
  3. Teams Guest Access: Require Entra ID External Collaboration restrictions + Purview Sensitivity Labels on Teams/Groups (Confidential, Internal) to control guest invites at the container level.

Book Series Navigation



References & Official Microsoft Documentation

💬 Reader Comments & Feedback

Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.