Krrish
Krrish

Reputation: 135

List of Azure SQL databases - usage by server using REST API

I can get a database usage report (including DB actual and maximum size) for a single database using REST API:

https://learn.microsoft.com/en-us/rest/api/sql/2021-05-01-preview/database-usages/list-by-database?tabs=HTTP

I want to get the same database usage report by server name for all the databases on that server. Is it possible using the Azure REST API?

Upvotes: 0

Views: 645

Answers (1)

Alberto Morillo
Alberto Morillo

Reputation: 15648

You can list of all databases contained on that Azure SQL logical server using this REST API.

GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases?api-version=2021-05-01-preview

You can then iterate through the list returned and get the database usage for each database using the REST API you referenced in your question.

Upvotes: 1

Related Questions