In this Azure PowerShell article, we will discuss the syntax and the usage of the Get-AzSqlDatabase PowerShell command with examples.
Table of Contents
Get-AzSqlDatabase
This is an excellent Azure PowerShell command to retrieve the list of Azure SQL databases from your Azure SQL Database Server.
Syntax
Below is the syntax of the Get-AzSqlDatabase PowerShell command.
Get-AzSqlDatabase
[[-ResourceGroupName] <String>
[-ServerName] <String>Get-AzSqlDatabase [[-ResourceGroupName] <String> [-ServerName] <String>
[[-DatabaseName] <String>]Let’s discuss a quick example of how to use the Get-AzSqlDatabase PowerShell command.
Example-1
You can execute the following PowerShell command to get the list of Azure SQL databases from the specified Azure SQL Server.
Get-AzSqlDatabase -ResourceGroupName "Demo1234" -ServerName "azurelessonssql"After executing the above PowerShell command, I got the following output as expected.
ResourceGroupName : Demo1234
ServerName : azurelessonssql
DatabaseName : DemoAzureLessons
Location : eastus
DatabaseId : d62d1382-01fe-4e99-9d9f-0792d524d601
Edition : Basic
CollationName : SQL_Latin1_General_CP1_CI_AS
CatalogCollation :
MaxSizeBytes : 2147483648
Status : Online
CreationDate : 05-09-2023 07:55:23
CurrentServiceObjectiveId : 00000000-0000-0000-0000-000000000000
CurrentServiceObjectiveName : Basic
RequestedServiceObjectiveName : Basic
RequestedServiceObjectiveId :
ElasticPoolName :
EarliestRestoreDate :
Tags : {}
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/Demo1234/providers/Microsoft.Sql/servers/azureles
sonssql/databases/DemoAzureLessons
CreateMode :
ReadScale : Disabled
ZoneRedundant : False
Capacity : 5
Family :
SkuName : Basic
LicenseType :
AutoPauseDelayInMinutes :
MinimumCapacity :
ReadReplicaCount :
HighAvailabilityReplicaCount :
CurrentBackupStorageRedundancy : Geo
RequestedBackupStorageRedundancy : Geo
SecondaryType :
MaintenanceConfigurationId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/
SQL_Default
EnableLedger : False
PreferredEnclaveType :
PausedDate :
ResumedDate :
Identity :
EncryptionProtector :
Keys :
FederatedClientId : You can see the same output below

Example-2
You can execute the PowerShell command below to retrieve a database by the specified name on the mentioned server.
Get-AzSqlDatabase -ResourceGroupName "Demo1234" -ServerName "azurelessonssql" -DatabaseName "DemoAzureLessons"After executing the above PowerShell script, I got the expected output as below.

Video Tutorial
Conclusion
In this Azure PowerShell article, we discuss the syntax and usage of the Get-AzSqlDatabase PowerShell command, along with examples. Thanks for reading this article !!!
You may also like the following articles

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
