Skip to content

/flags/sharepoint-online/set-sposite-storagequota

Set-SPOSite -StorageQuota: set a site storage limit in MB (with a warning level)

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
SharePoint Online PowerShell
command
Set-SPOSite
flag
-StorageQuota <MB> (with -StorageQuotaWarningLevel <MB>)
default
with pooled (automatic) storage, sites have no individual limit below 25 TB

Set-SPOSite -Identity URL -StorageQuota 51200 -StorageQuotaWarningLevel 46080 sets a storage limit of 50 GB on a site collection and sends a warning to the site collection administrators at 45 GB. Both values are in megabytes: the reference says -StorageQuota "Specifies the storage quota in megabytes of the site collection" and -StorageQuotaWarningLevel "Specifies the warning level in megabytes of the site collection to warn the site collection administrator that the site is approaching the storage quota." Individual limits are used when the tenant's site storage limits are set to Manual in the SharePoint admin center.

powershell
Connect-SPOService -Url https://contoso-admin.sharepoint.com
Set-SPOSite -Identity https://contoso.sharepoint.com/sites/archive -StorageQuota (50GB/1MB) -StorageQuotaWarningLevel (45GB/1MB)
Get-SPOSite -Identity https://contoso.sharepoint.com/sites/archive |
  Select-Object Url, StorageQuota, StorageQuotaWarningLevel, StorageUsageCurrent

Types and units

Both parameters are 64-bit integers. PowerShell's size suffixes produce bytes, so divide by 1MB; passing 50GB directly would ask for 53,687,091,200 MB. Checked offline in Windows PowerShell 5.1 with module 16.0.27709.12000:

powershell
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
$c = Get-Command Set-SPOSite
foreach ($n in 'StorageQuota', 'StorageQuotaWarningLevel', 'StorageQuotaReset') { "{0}: {1}" -f $n, $c.Parameters[$n].ParameterType.Name }
"50GB is {0} bytes; 50GB/1MB is {1} MB" -f 50GB, (50GB/1MB)
try { Set-SPOSite -Identity https://contoso.sharepoint.com/sites/archive -StorageQuota (50GB/1MB) -ErrorAction Stop } catch { $_.Exception.Message }

Output

StorageQuota: Int64
StorageQuotaWarningLevel: Int64
StorageQuotaReset: SwitchParameter
50GB is 53687091200 bytes; 50GB/1MB is 51200 MB
No connection available. Use Connect-SPOService before running this CmdLet.
ParameterEffect
-StorageQuota MBmaximum storage for the site collection
-StorageQuotaWarningLevel MBsize at which site collection administrators get a warning
-StorageQuotaResetreset a OneDrive to the tenant default storage space
Get-SPOSite ... StorageUsageCurrentcurrent usage in MB, to compare with the quota
Admin center > Settings > Site storage limitsswitch between Automatic (pooled) and Manual

Pitfalls

  • Units. MB in PowerShell, GB in the admin center. Microsoft's admin center maximum is 25600 GB, the same 25 TB limit sites get with pooled storage.
  • Automatic mode. In the default pooled mode you don't need per-site limits; "If you previously set storage limits manually and switch to using pooled storage, SharePoint resets all the limits to 25 TB."
  • Warning above the quota. Keep the warning level below the quota, or the warning never fires before the site is full.
  • Full sites. When a site reaches its quota, uploads fail; owners can request more from Storage Metrics, which emails the Global Administrators.
  • Reporting. To find sites close to their limit across the tenant, see Get-SPOSite storage usage and Get-SPOSite -Limit All.

FAQ

Is -StorageQuota in GB or MB?

In megabytes. The reference says it specifies the storage quota in megabytes. The admin center asks for GB, so multiply by 1024: 100 GB is -StorageQuota 102400, or use PowerShell's 100GB/1MB.

Why does my quota have no effect?

Individual site limits apply when the organization's site storage limits setting is Manual. With the default automatic (pooled) storage, sites draw from the central pool, and switching back to pooled storage resets all limits to 25 TB.

How do I reset a OneDrive to the tenant default quota?

Use Set-SPOSite -Identity ONEDRIVE_URL -StorageQuotaReset. The switch resets the OneDrive for Business storage quota to the tenant's new default storage space.

Sources