Get-AzureRmSqlDatabase
Gets one or more databases.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
Get-AzureRmSqlDatabase
[[-DatabaseName] <String>]
[-ServerName] <String>
[-ResourceGroupName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Get-AzureRmSqlDatabase cmdlet gets one or more Azure SQL databases from an Azure SQL Database Server. This cmdlet is also supported by the SQL Server Stretch Database service on Azure.
Examples
Example 1: Get all databases on a server
PS C:\>Get-AzureRmSqlDatabase -ResourceGroupName "resourcegroup01" -ServerName "server01"
ResourceGroupName : resourcegroup01
ServerName : server01
DatabaseName : master
Location : Central US
DatabaseId : a2a7f2db-7526-4d86-a7b2-36276ee10dc6
Edition : None
CollationName : SQL_Latin1_General_CP1_CI_AS
CatalogCollation :
MaxSizeBytes : 5368709120
Status : Online
CreationDate : 7/3/2015 7:32:44 AM
CurrentServiceObjectiveId : c99ac918-dbea-463f-a475-16ec020fdc12
CurrentServiceObjectiveName : System1
RequestedServiceObjectiveId : c99ac918-dbea-463f-a475-16ec020fdc12
RequestedServiceObjectiveName :
ElasticPoolName :
EarliestRestoreDate :
Tags :
ResourceGroupName : resourcegroup01
ServerName : server01
DatabaseName : database01
Location : Central US
DatabaseId : a1e6bd1a-735a-4d48-8b98-afead5ef1218
Edition : Standard
CollationName : SQL_Latin1_General_CP1_CI_AS
CatalogCollation :
MaxSizeBytes : 268435456000
Status : Online
CreationDate : 7/3/2015 7:33:37 AM
CurrentServiceObjectiveId : f1173c43-91bd-4aaa-973c-54e79e15235b
CurrentServiceObjectiveName : S0
RequestedServiceObjectiveId : f1173c43-91bd-4aaa-973c-54e79e15235b
RequestedServiceObjectiveName :
ElasticPoolName :
EarliestRestoreDate :
Tags :
This command gets all databases on the server named server01.
Example 2: Get a database by name on a server
PS C:\>Get-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database02"
ResourceGroupName : resourcegroup01
ServerName : server01
DatabaseName : database01
Location : Central US
DatabaseId : a1e6bd1a-735a-4d48-8b98-afead5ef1218
Edition : Standard
CollationName : SQL_Latin1_General_CP1_CI_AS
CatalogCollation :
MaxSizeBytes : 268435456000
Status : Online
CreationDate : 7/3/2015 7:33:37 AM
CurrentServiceObjectiveId : f1173c43-91bd-4aaa-973c-54e79e15235b
CurrentServiceObjectiveName : S0
RequestedServiceObjectiveId : f1173c43-91bd-4aaa-973c-54e79e15235b
RequestedServiceObjectiveName :
ElasticPoolName :
EarliestRestoreDate :
Tags :
This command gets a database named Database02 from a server named Server01.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DatabaseName
Specifies the name of the database to retrieve.
Type: | String |
Aliases: | Name |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of the resource group to which the database server is assigned.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServerName
Specifies the name of the server to which the database is assigned.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |