https://docs.microsoft.com/en-us/sharepoint/manage-site-collection-storage-limits
In report below, it is possible to retrieve used storage space, but not the allocated.
Jan 08 2021 03:49 AM
How can I retrieve programmatically SharePoint Online allocated (purchased) storage space of the whole tenant, which is visualized "In the upper right of the page":
https://docs.microsoft.com/en-us/sharepoint/manage-site-collection-storage-limits
In report below, it is possible to retrieve used storage space, but not the allocated.
Jan 09 2021 12:30 AM
You could try to use the PowerShell Get-SPOSite with the --StorageUsageCurrent parameter.
Run it for all sites and calculate the total.
Not sure if this would work in your case.
Get-SPOSite (SharePointOnlinePowerShell) | Microsoft Docs