Monitoring SharePoint Online site collection storage usage is essential for effective capacity planning and storage management. Microsoft 365 assigns a storage quota to each SharePoint tenant, and administrators need to ensure that sites do not exceed allocated limits.
Using PnP PowerShell, you can quickly retrieve storage details of all site collections, including current storage usage, storage limits, and available space.
This guide explains how to check SharePoint Site Collection storage usage using PnP PowerShell step by step.
Prerequisites
Before running any commands, ensure the following:
Global Administrator or SharePoint Administrator permissions
PnP PowerShell installed
Connected to SharePoint Admin Center
Step 1: Install and Import PnP PowerShell Module
If you haven’t installed PnP PowerShell, install it using:
Install-Module -Name PnP.PowerShell -Scope CurrentUser -AllowClobber -Force
Then, import the module:
Import-Module PnP.PowerShell
Step 2: Connect to SharePoint Admin Center
To retrieve site collection details, you need to connect to the SharePoint Admin Center:
powershellCopyEditConnect-PnPOnline -Url "https://yourtenant-admin.sharepoint.com" -Interactive
🔹 Replace yourtenant
with your actual SharePoint tenant name.
🔹 The -Interactive
flag prompts for authentication.
For App-based authentication, use:
Connect-PnPOnline -Url "https://yourtenant-admin.sharepoint.com" -ClientId "Your-App-Client-ID" -Tenant "yourtenant.onmicrosoft.com" -CertificatePath "Path\To\Certificate.pfx"
Step 3: Get Storage Usage for a Specific Site
To check the storage usage of a single site collection, use:
Get-PnPTenantSite -Url "https://yourtenant.sharepoint.com/sites/YourSite" | Select-Object Url, StorageUsage, StorageQuota, StorageQuotaWarningLevel
🔹 Replace "https://yourtenant.sharepoint.com/sites/YourSite"
with the actual site URL.
🔹 This command retrieves:
- StorageUsage (in MB) – Current space used
- StorageQuota (in MB) – Total allocated storage
- StorageQuotaWarningLevel (in MB) – Threshold for warning notifications
Step 4: Get Storage Usage for All Site Collections
To retrieve storage details for all site collections:
Get-PnPTenantSite | Select-Object Url, StorageUsage, StorageQuota, StorageQuotaWarningLevel | Format-Table -AutoSize
This command lists all site collections with their storage details.
If you want to export the data to a CSV file:
Get-PnPTenantSite | Select-Object Url, StorageUsage, StorageQuota, StorageQuotaWarningLevel | Export-Csv -Path "C:\StorageReport.csv" -NoTypeInformation
The CSV file will contain a detailed report of storage usage across all sites.
Step 5: Identify Sites Exceeding Storage Quota
If you want to identify sites that are running out of storage, use:
Get-PnPTenantSite | Where-Object { $_.StorageUsage -ge $_.StorageQuotaWarningLevel } | Select-Object Url, StorageUsage, StorageQuota, StorageQuotaWarningLevel | Format-Table -AutoSize
This command lists sites where storage usage has exceeded the warning level, helping admins take action before reaching the limit.
Step 6: Set or Modify Storage Quota
If you need to increase storage quota for a specific site:
Set-PnPTenantSite -Url "https://yourtenant.sharepoint.com/sites/YourSite" -StorageQuota 1024000
This sets the site’s storage quota to 1TB (1024000 MB).
You can also set a storage warning level:
Set-PnPTenantSite -Url "https://yourtenant.sharepoint.com/sites/YourSite" -StorageQuotaWarningLevel 800000
This sets a storage warning threshold of 800GB (800000 MB).
Step 7: Disconnect the PowerShell Session
Once you have completed the process, disconnect from SharePoint Online:
Disconnect-PnPOnline
Common Errors & Troubleshooting
Error | Possible Cause | Solution |
---|---|---|
Access Denied | Insufficient permissions | Ensure you are a SharePoint Admin or Global Admin |
Cannot connect to SharePoint Online | Authentication issues | Use -Interactive login mode |
Command not recognized | PnP PowerShell module missing | Run Install-Module -Name PnP.PowerShell |
StorageQuota exceeded | Site has reached its limit | Increase storage quota using Set-PnPTenantSite |