< Back

Get-AzureRmSqlDatabase

Tue Jan 29, 2019 10:08 pm

NAME Get-AzureRmSqlDatabase



SYNOPSIS

Gets one or more databases.





SYNTAX

Get-AzureRmSqlDatabase [-ResourceGroupName] <String> [-ServerName] <String> [[-DatabaseName] <String>] [-DefaultProfile <IAzureContextContainer>]

[-Confirm] [-WhatIf] [<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.





PARAMETERS

-DatabaseName <String>

Specifies the name of the database to retrieve.



Required? false

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ResourceGroupName <String>

Specifies the name of the resource group to which the database server is assigned.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServerName <String>

Specifies the name of the server to which the database is assigned.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel







NOTES









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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... qldatabase

New-AzureRmSqlDatabase

Remove-AzureRmSqlDatabase

Resume-AzureRmSqlDatabase

Set-AzureRmSqlDatabaseBackupLongTermRetentionPolicy

Suspend-AzureRmSqlDatabase