Is there a way to set storage- and resource-quota on existing site collection using CSOM and Powershell?

  • there is no MaximumStorageLevel property like at SiteCreationInformation
  • using Powershell Set-SPOSite is not an option
  • I can pull property bags for webs using $ctx.Web.AllProperties, but I didn't find a similar option for $ctx.Site
  • I am aware of Auto Storage feature coming soon - it's also not an option

Any help or pointing in the right direction will be appreciated.

  • Why would set-sposite not be an option if you are using powershell? Have you not installed the SPO cmdlets? Commented Jul 6, 2015 at 17:01

1 Answer 1


I don't understand why Set-SPOSite would not be an option if you are using PowerShell, install the components, you'd need to install the DLLs for the client side components anyway.

#The size in MB to set existing site collections
$newQuota = 10240
$sites = Get-SPOSite -Limit All
foreach($site in $sites){
    #If the site has a storage quota of zero, it is managed internally, skip over it
    if($site.StorageQuota -ne 0){
        Set-SPOSite -Identity $site -StorageQuota $newQuota

Just last week I created these in our PowerShell module, again, there is no reason here that prevents you from using set-sposite to manage video channel quotas:

#region Office Video
function Get-SPOVideoChannels {
           Pulls back all the video channels in Office 365 Video
           Pulls back all the video channels in Office 365 Video
           $videos = Get-SPOVideoChannels
            foreach($channel in $videos.GetEnumerator()){
           Returns a collection of channels
           This operation takes a little time to complete, be patient

    $channelInventory = New-Object System.Collections.Specialized.OrderedDictionary
    $SPOQueryUrl= "https://tenant.sharepoint.com/_api/search/query?querytext=%27contentclass:sts_site WebTemplate:POINTPUBLISHINGTOPIC%27&SelectProperties=%27Sitename%27&rowlimit=5000"

    $request = [System.Net.WebRequest]::Create($SPOQueryUrl)
    $request.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credential.UserName, $credential.Password)
    $request.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
    $request.Accept = "application/json;odata=verbose"
    $request.Method = [Microsoft.PowerShell.Commands.WebRequestMethod]::Get

    $response = $request.GetResponse()
    $requestStream = $response.GetResponseStream()
    $readStream = New-Object System.IO.StreamReader $requestStream
    $data = $readStream.ReadToEnd()

    $results = $data | ConvertFrom-Json
    $N4result = $results.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results.Cells.results
    $Channels = @()
    foreach($r in $N4result){
        if($r.Key -eq "SiteName") {
            $Channels += $r.Value

    foreach($chname in $Channels){
          $site = Get-SPOSite -Identity $chname -Detailed
          $channelInventory.Add($site.Title, [PSCustomObject] @{
            URL = $site.URL
            StorageGB = [System.Math]::Round(($site.StorageUsageCurrent/1024),2)
            QuotaGB = ($site.StorageQuota/1024)
            WarningGB = [System.Math]::Round(($site.StorageQuotaWarningLevel/1024),2)
            UsagePercentage = [System.Math]::Round(($site.StorageUsageCurrent/$site.StorageQuota)*100,0)
    return $channelInventory            
function Set-SPOChannelQuotas {
        Updates site quota settings.
        Updates site quota settings.
        .PARAMETER Url
        The site collection Url
        .PARAMETER GBs
        The storage tier in GB.
        Updating a project space
        Set-SPOChannelQuotas -Url "https://tenant.sharepoint.com/portals/communications" -GBs 5 
            [Parameter(Mandatory=$true,HelpMessage="The channel URL",Position=0)][ValidateNotNull()]
            [Parameter(Mandatory=$true,HelpMessage="The storage tier in GBs",Position=1)][ValidateSet("1","5","10","15","20","25")]
    switch ($GBs){
                "5" {
                    $storage = 5120
                    $warn = 4608
                "10" {
                    $storage = 10240
                    $warn = 9216
                "15" {
                    $storage = 15360
                    $warn = 13824
                "20" {
                    $storage = 20480
                    $warn = 18432
                "25" {
                    $storage = 25600
                    $warn = 23040
                default {
                    $storage = 1024
                    $warn = 922

    Set-SPOSite -Identity $Url -StorageQuotaWarningLevel $warn -StorageQuota $storage
  • Thanks, but Set-SPOSite is not working for a) video channels b) sites stuck in updating c) few more situations. I have SharePoint Online Management Shell and can apply Set-SpoSite for most of the site collections. That's not the case here.
    – grisha
    Commented Jul 6, 2015 at 20:30
  • 1
    You can still use set-sposite to set video channel quotas, if it can be set through the UI, you can do it in PowerShell with set-spsite. Commented Jul 6, 2015 at 20:46
  • Let me repeat once again - Set-SPOSite is not an option. User Interface is not an option either, because the video channels do not show in the site collections list. Since apparently you are doing it this way, can you post a screen how you edit storage quota via UI for video channels that are not listed among the site collections in the SPO Admin Center?
    – grisha
    Commented Jul 7, 2015 at 7:38
  • How are channels not displayed in the site collection list? Every video channel I've created always shows Commented Jul 7, 2015 at 12:14
  • @grisha updated with more information. Hope this helps. Commented Nov 7, 2016 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.