简体   繁体   中英

Is it possible to list all databases in Azure via REST API

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM