Retrieve Dataverse storage actual values programmatically
Craig Harvey
Business Applications Technical Specialist spreading the awesomeness that is Dynamics 365 and the Power Platform.
The Power Platform Admin Centre shows Dataverse storage values, but have you ever wanted to retrieve those values programmatically? Store and plot them on your own chart?
Short version - install the Power Platform COE Kit, it will retrieve the actual values for each Dataverse environment and update a record in a Dataverse table for you.
Longer version - for the people that need these values for other reasons, or can't install the COE Kit yet for reasons*, you can create a Flow that does the same thing as the COE Kit.
The Power Platform Admin Connector allows a user with Admin rights to retrieve the actual values for Database, File and Log storage for each environment. You can then do what you want with these - total it up for a tenant wide value, or track it over time to see growth.
This simple Flow shows the concept (what is missing is the logic you want to do with the values later).
You'll need to set the API version value to 2021-03-01 and also specify that the following properties should be expanded: properties.capacity,properties.addons
That's it. When you run it, the results will include the Dataverse environment(s) the user has access to. A a snippet of that JSON result is shown below.
?"isDefault": false,
??????? "capacity": [
????????? {
??????????? "capacityType": "Database",
?????????? "actualConsumption": 3316.128,
??????????? "ratedConsumption": 3316.128,
??????????? "capacityUnit": "MB",
??????????? "updatedOn": "2024-03-13T21:29:42Z"
????????? },
????????? {
??????????? "capacityType": "File",
??????????? "actualConsumption": 5826.816,
??????????? "ratedConsumption": 5826.816,
??????????? "capacityUnit": "MB",
??????????? "updatedOn": "2024-03-13T21:29:42Z"
????????? },
????????? {
??????????? "capacityType": "Log",
??????????? "actualConsumption": 0,
??????????? "ratedConsumption": 0,
??????????? "capacityUnit": "MB",
??????????? "updatedOn": "2024-03-13T21:29:42Z"
????????? }
With Flow you can run through those results and do what you like with it.
Hoped this helped you understand some of what you can do with the Admin APIs.