Reputation: 1920
I need to receive list of existed databases in Microsoft Azure account. I do see REST API for example MySQL servers and databases, PostgeSQL servers and databases and so on. My question is there any action that lists all databases in one request or do I need to search them one by one? Thanks in advance
Upvotes: 1
Views: 749
Reputation: 16401
You can use this REST API: Resources - List
GET https://management.azure.com/subscriptions/{subscriptionId}/resources?$filter={$filter}&api-version=2019-05-10
Add the $filter like this:
ResourceType eq 'Microsoft.DBforPostgreSQL/servers' or ResourceType eq 'Microsoft.Sql/servers/databases'
If you want to list other type of Azure SQL database, just follow the format above the filter.
Note:
If your resources are too more, you will need to call the API in the 'nextLink'.
Using the API can help you lists all databases in one request.
Hope this helps.
Upvotes: 5