SharePoint Online: Change Storage Quota of Site Collection using PowerShell

Requirement: Increase storage quota in SharePoint Online using PowerShell.

How to set the storage quota of a site collection in SharePoint Online?
By default, SharePoint Online uses an automatic storage quota management from the storage pool allocated to the tenant, to reduce administrator efforts. However, you can take over the storage management and adjust site quotas on each site collection. To set storage quota of a SharePoint site collection, Follow these steps:
  • Login to your SharePoint Online Admin Center (https://<tenant>-admin.sharepoint.com)
  • Expand "Sites" >> Click on "Active Sites" in the left navigation.
  • Select the site collection to set its storage limit. Click on the "Storage" button the toolbar. (You'll see the "Storage" option in the toolbar only when the storage management option is set to "Manual"! More on setting storage management options in SharePoint Online is here: Office 365: Managing Site Storage Limits in SharePoint Online)
  • This brings the "Edit storage limit" panel to set the storage limit for the selected site collection. Enter a maximum storage value in GB. Say, You want to allocate 10 TB storage space to a site collection, enter "10240". You can set the warning threshold as well for the site owners to get notified when it reaches the threshold value.
    sharepoint online change storage quota

Increase Site Storage Quota in Classic Admin Center:
If you are using a classic admin center, Click on the "Site Collections" link in the left navigation. From the available site collections, Select the target site collection to change storage quota,  Click on "Storage Quota" button from the ribbon.
sharepoint online change storage quota

From the storage quota page, enter the new quota for your site collection. You can optionally enable Email notification to the site administrators when storage reaches a particular threshold.
sharepoint online set storage quota

Click on "Save" to commit apply new storage quota to your SharePoint Online site.

How to Change storage quota using PowerShell in SharePoint Online?
To set storage quota in SharePoint Online, use: Set-SPOSite cmdlet. Here is how to increase storage quota in SharePoint Online using PowerShell:

Step 1: Connect to SharePoint Online as SharePoint Online Administrator or Tenant Admin
$AdminURL="https://crescent-admin.sharepoint.com"
Connect-SPOService -URL $AdminURL -Credentials (Get-Credential) 

Step 2: Change storage quota with Set-SPOSite cmdlet.
$SiteURL="https://crescent.sharepoint.com/sites/marketing"
#Set Storage Quota
Set-SPOSite -Identity $SiteURL -StorageQuota 2048
It takes a while to execute and sets the storage quota of the given site collection to 2GB. You can verify the new storage quota from the Admin site.
sharepoint online increase storage quota powershell

Set Storage Quota for a Site using PnP PowerShell:
Lets set storage limit for a site collection to 10GB using PnP PowerShell.
#Set Parameters
$TenantAdminURL = "https://crescentintranet-admin.sharepoint.com"
$SiteURL = "https://crescentintranet.sharepoint.com/sites/Sales"

#Connect to SharePoint Admin Center
Connect-PnPOnline -Url $TenantAdminURL -UseWebLogin

#set storage quota for the site in MBs
Set-PnPTenantSite -Url $SiteURL -StorageWarningLevel 8192 -StorageMaximumLevel 10240

How to Increase Storage Quota for All Site Collections?
Here is the PowerShell to set quota in SharePoint Online
#Get all the site collection
$AllSites = Get-SPOSite -Limit All

#Set Storage quota for each site collection
Foreach ($Site in $AllSites)
{
   Set-SPOSite -Identity $Site.URL -StorageQuota 10000 -StorageQuotaWarningLevel 8000
}
This script blindly sets all site collection's storage quota to 10GB.

Increase storage space in SharePoint Online
How about increasing the existing quota by a specific storage space? E.g. Add 5GB to existing site?
Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameChecking

#Parameters
$AdminCenterURL="https://Crescent-Admin.SharePoint.com"
$SiteURL = "https://Crescent.SharePoint.com/sites/marketing"
$QuotaIncrease = 5 #5 GB

#Setup Credentials to connect
$Cred = Get-Credential

Connect-SPOService -Url $AdminCenterURL -Credential $Cred
      
#Get the Site Collection
$Site = Get-SPOSite -Identity $SiteURL -Detailed

#Calculate New Storage Quota
$CurrentStorage = $Site.StorageQuota
$NewStorage = $CurrentStorage + ($QuotaIncrease * 1024)

#Increase Storage Quota
Set-SPOSite -Identity $SiteURL -StorageQuota $NewStorage
Write-Host "Storage Quota set from '$CurrentStorage' to '$NewStorage'" -f Green
Please note, these quota changes takes effect only when the tenant storage method is manual! Here is my another post on generating storage quota report in SharePoint Online: SharePoint Online: Get Site Storage Quota Report using PowerShell

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.