Hi @ali razeghi
Thank you for posting in Q & A.
Below URL shows steps to query all database servers within a resource group.
API call - Servers - List By Resource Group
https://learn.microsoft.com/en-us/rest/api/sql/servers/listbyresourcegroup
How to list all databases in Azure CLI
https://stackoverflow.com/questions/47452890/how-to-list-all-databases-in-azure-cli
Get all instances of SQL Server assigned to a resource group
https://learn.microsoft.com/en-us/powershell/module/az.sql/get-azsqlserver?view=azps-5.7.0
If the Answer is helpful, please click Accept Answer
and up-vote, this can be beneficial to other community members.