Get-AzureSqlDatabase

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Get-AzureSqlDatabase

Returns a Windows Azure SQL Database either from the specified SQL Database Server connection context or from a specified SQL Database Server.

Syntax

Parameter Set: ByConnectionContext
Get-AzureSqlDatabase [-ConnectionContext] <IServerDataServiceContext> [-Database <Database> ] [-DatabaseName <String> ] [ <CommonParameters>]

Parameter Set: ByServerName
Get-AzureSqlDatabase [-ServerName] <String> [-Database <Database> ] [-DatabaseName <String> ] [ <CommonParameters>]

Detailed Description

Use the Get-AzureSqlDatabase cmdlet to retrieve a SQL Database by name either from the specified SQL Database Server connection context or from a specified SQL Database Server. You can create a SQL Database Server connection context using the New-AzureSqlDatabaseServerContext cmdlet, and then use it with this cmdlet.

When you retrieve a database by specifying a SQL Database Server, the Get-AzureSqlDatabase cmdlet creates a temporary connection context using the specified SQL Database Server name and the current Windows Azure subscription information to perform the operation.

If the database name is not specified, the Get-AzureSqlDatabase cmdlet returns all SQL Databases for the specified connection context or SQL Database Server.

Parameters

-ConnectionContext<IServerDataServiceContext>

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

Aliases

Context

Required?

true

Position?

1

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

-ServerName<String>

The name of SQL Database Server from where to retrieve the database.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.WindowsAzure.Management.SqlDatabase.Services.Server.Database

Outputs

The output type is the type of the objects that the cmdlet emits.

  • IEnumerable<Microsoft.WindowsAzure.Management.SqlDatabase.Services.Server.Database>

    Note: Some of the metadata returned by this output object are associated with the preview of Windows Azure SQL Database Premium Edition. Only participants in the preview are able to use this data. To learn more about the preview, please see https://go.microsoft.com/fwlink/p/?LinkId=308949.

Examples

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

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

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

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

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

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

New-AzureSqlDatabase

Remove-AzureSqlDatabase

Set-AzureSqlDatabase

New-AzureSqlDatabaseServerContext