OneDrive / onedrive-api-docs

Official documentation for the OneDrive API
MIT License
453 stars 229 forks source link

Get-MgSiteDrive Quota values not correct for Remaining and Used properties #1869

Open atn-3644 opened 2 months ago

atn-3644 commented 2 months ago

Category

Expected or Desired Behavior

Exporting accurate Quota values for OneDrive for Business sites that can be used for capacity planning analysis. For this purpose, I have to use Microsoft Graph.

Observed Behavior

I have used following methods:

The values returned for Quota.Used do not match the values from Admin Portal, under User Details Panel > OneDrive. The differences are not small, they can get to up to 600GB. Even more, in some cases Quota.Remaining > Quota.Total and this leads to Quota.Used to have a negative value.

I have double checked this using Powershell Module Microsoft.Online.SharePoint.PowerShell. Cmdlet Get-SPOSite -IncludePersonalSite:$true -Limit All -Filter "Url -like 'https://****-my.sharepoint.com/personal/*'" | select Url , StorageUsageCurrent, StorageQuota returns StorageUsageCurrent with the same value as the one displayed in Admin Portal under User Details Panel > OneDrive

Steps to Reproduce

I have not been able to reproduce the issue on another tenant until now, as I do not know the cause.

Thank you.

persident commented 3 weeks ago

I can confirm for other tenants that sometimes a negative value is returned for Quota.Used when queried via Graph API:

$Uri = 'https://graph.microsoft.com/v1.0/users/{0}/drive?$select=quota' -f $UserPrincipalName
$Response = Invoke-MgGraphRequest -Uri $Uri

I have not yet verified if the other values are correct.