Get-AzSqlDatabase

In this Azure PowerShell article, we will discuss the syntax and the usage of the Get-AzSqlDatabase PowerShell command with examples.

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

Get-AzSqlDatabase

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.

Get-AzSqlDatabase PowerShell

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

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!