question

PoulChristensen-5014 avatar image
0 Votes"
PoulChristensen-5014 asked PoulChristensen-5014 commented

Get-AzSqlDatabase only returns 100 databases

Get-AzSqlDatabase only returns 100 databases.

How to get all?

azure-sql-database
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What is the count it returns when you run below:

 $a = get-azsqldatabase -servername YourServerName -resourcegroupname YourRG
 $a.count
0 Votes 0 ·

1 Answer

AnuragSharma-MSFT avatar image
0 Votes"
AnuragSharma-MSFT answered PoulChristensen-5014 commented

Hi @PoulChristensen-5014, welcome to Microsoft Q&A forum.

Get-AzSqlDatabase displays all the databases and would not limit the number to 100. I tried creating more than 100 databases and with 'Get-AzSqlDatabase I was able to return it all. We can also check the count of databases using same command to be sure.

However when we run the same command using Azure Portal PowerShell or Windows PowerShell, there are chances that the result would not show all databases due to text truncation. I would suggest you to export the result of the command through Windows PowerShell and verify the same.

  Get-AzSqlDatabase -servername <servername> -resourcegroupname <resgrpname> | Export-Csv -Path "<path/nameoffile>.csv"

Please let us know if this helps or else we can discuss further.


If answer helps, you can mark it 'Accept Answer'




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the quick reply and you are completely right

When I try this from Azure Powershell i get 100
117424-image.png

When I try the same from WIndows Powershell i get the correct 256 databases
117462-image.png


0 Votes 0 ·
image.png (39.3 KiB)
image.png (11.2 KiB)