Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Get-AzureSqlDatabase

Get-AzureSqlDatabase

microsoft.windowsazure.commands.sqldatabase.dll

Synopsis

Returns an Azure SQL Database from the specified SQL Database Server.

Syntax

Get-AzureSqlDatabase [-ConnectionContext] [-Database] [-DatabaseName] [-RestorableDropped] [-RestorableDroppedDatabase] [-DatabaseDeletionDate] [<CommonParameters>]

Get-AzureSqlDatabase [-ServerName] [-Database] [-DatabaseName] [-RestorableDropped] [-RestorableDroppedDatabase] [-DatabaseDeletionDate] [<CommonParameters>]

Detailed Description

Use the Get-AzureSqlDatabase cmdlet to retrieve a SQL Database from a SQL Database Server. You can specify the server with a SQL Database Server connection context that you create using the New-AzureSqlDatabaseServerContext cmdlet. Or, if you specify the SQL Database Server name, the cmdlet uses the current Azure subscription information to authenticate the request to access the server. You also can retrieve a restorable dropped database by specifying the RestorableDropped parameter. You can select the database to return by specifying the name and deletion date with the DatabaseDeletionDate parameter. If you specify the RestorableDropped parameter and do not specify a database name and deletion date, then all restorable dropped databases on the specified server are returned.If the database is not specified, the Get-AzureSqlDatabase cmdlet returns all SQL Databases from the specified SQL Database Server.

Parameters

-ConnectionContext <IServerDataServiceContext>

The connection context to a SQL Database Server from which to retrieve a SQL database.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

-Database <Database>

A database object representing the SQL Database to be retrieved.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-DatabaseName <String>

The name of the SQL Database to be retrieved.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-RestorableDropped <SwitchParameter>

If specified, the Get-AzureSqlDatabase cmdlet returns RestorableDroppedDatabase objects instead of Database objects, and the DatabaseDeletionDate parameter may be used to select a specific restorable dropped database.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-RestorableDroppedDatabase <RestorableDroppedDatabase>

The object representing the restorable dropped database to retrieve.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-DatabaseDeletionDate <DateTime>

If the RestorableDropped parameter is specified, then you can use this parameter to retrieve a restorable dropped database based on the deletion date.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ServerName <String>

The name of the SQL Database Server containing the database to be retrieved. The cmdlet uses the current Azure subscription to access the server.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

Input Type

Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database

Return Type

IEnumerable<Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database>

Notes

Examples

-------------------------- EXAMPLE 1 --------------------------

This example returns all the databases on the SQL Database Server, "lpqd0zbr8y".

PS C:\> C:\PS>Get-AzureSqlDatabase -ServerName "lpqd0zbr8y"

-------------------------- EXAMPLE 2 --------------------------

This example returns all the restorable dropped databases on the SQL Database Server, "lpqd0zbr8y".

PS C:\> C:\PS>Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" -RestorableDropped

-------------------------- EXAMPLE 3 --------------------------

This example returns the database, "Database1", from the SQL Database Server specified by the connection context “$ctx”.

PS C:\> C:\PS>$database1 = Get-AzureSqlDatabase -ConnectionContext $ctx -DatabaseName "Database1"

-------------------------- EXAMPLE 4 --------------------------

This example returns the database, "Database1", from the SQL Database Server, "lpqd0zbr8y".

PS C:\> C:\PS>$database1 = Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" -DatabaseName "Database1"

-------------------------- EXAMPLE 5 --------------------------

This example returns the restorable dropped database, "Database1", that was deleted on 11/9/2012 from SQL Database Server, "lpqd0zbr8y".

PS C:\> C:\PS>$droppedDB = Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" -DatabaseName "Database1" -DatabaseDeletionDate "2012-11-09T22:59:43.000Z" -RestorableDropped

New-AzureSqlDatabase
New-AzureSqlDatabaseServerContext
Remove-AzureSqlDatabase
Set-AzureSqlDatabase