Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] issue with Get-PnpTenant storage values. #4557

Open
1 task done
shitalkhaire opened this issue Nov 19, 2024 · 6 comments
Open
1 task done

[BUG] issue with Get-PnpTenant storage values. #4557

shitalkhaire opened this issue Nov 19, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@shitalkhaire
Copy link

shitalkhaire commented Nov 19, 2024

Reporting an Issue or Missing Feature

I have Sites.FullControl.All permission still i do not getting correct Storagequota and even not getting allocated storage data.

Expected behavior

I want total storage of Sharepoint Tenant and used storage.

Actual behavior

i am getting Allocated storage is zero and total Storage of Sharepoint admin center is different.

image

image

Steps to reproduce behavior

$Url = "https://xyz-admin.sharepoint.com"
$ClientId = "123456678-45-576575"
Connect-PnPOnline -Url $AdminCenterURL -Interactive -ClientId $CleintId
$tenantInfo = Get-PnPTenant
$Storagequota = $tenantInfo.StorageQuota
$Allocatedquota = $tenantInfo.StorageQuotaAllocated

What is the version of the Cmdlet module you are running?

PnP.PowerShell 2.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
@shitalkhaire shitalkhaire added the bug Something isn't working label Nov 19, 2024
@jackpoz
Copy link
Contributor

jackpoz commented Nov 24, 2024

Storage quota is the same as on SPO Admin Center, as it shows 1355776 MB, which is ~1,293 TB.

What do you get with Get-SPOTenant ? In my case I get the same numbers:

image

image

Looks more like an issue in SPO api itself than PnP PowerShell.

@shitalkhaire
Copy link
Author

Yes,I am getting same numbers in storageQuota with both cmdlets:

  1. PNP:
    image

  2. SPO:
    image

@shitalkhaire
Copy link
Author

I am getting StorageQuota as we see above in the output of the cmdlets and would like to see some values infront of StorageQuotaAllocated.
It would be great if I get StorageQuotaAllocated instead of zero '0'.

@jackpoz
Copy link
Contributor

jackpoz commented Nov 25, 2024

According to https://techcommunity.microsoft.com/discussions/sharepoint_general/what-is-the-storagequotaallocated-means-in-spo/297042 , the StorageQuotaAllocated is not the amount of space used, which is why it's 0.

As the Get-SPOTenant cmdlet is from Microsoft, you could open a support ticket asking if it's expected to be 0 or if there's an issue, and which field should give you what you are looking for. I have an old script around that checked the % used and I'll check which fields or report I used, it could be even from Graph.

@jackpoz
Copy link
Contributor

jackpoz commented Nov 26, 2024

I checked my scripts and found 2 ways:

  • Get-SPOGeoStorageQuota returns GeoUsedStorageMB as used capacity, matching what SPO Admin Center shows. It returns also TenantStorageMB as total:
    image
  • (Invoke-PnPSPRestMethod -Url "/_api/StorageQuotas()?api-version=1.3.2").value returns the same
    image

@shitalkhaire
Copy link
Author

Thank you very much! I would use the Rest API method as you mentioned above.
I am now getting the comparably relevant values of the Available Storage Quota of our Sharepoint tenant, here is my screenshot of the cmdlet's output:
image

I'll go for the main goal of the script, which is to create an alert inside SCOM when Sharepoint sites storage is less than 500GB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants