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
 

Remove-AzureSqlDatabase

Remove-AzureSqlDatabase

microsoft.windowsazure.commands.sqldatabase.dll

Synopsis

Deletes a Azure SQL Database from the specified SQL Database Server connection context or SQL Database Server.

Syntax

Remove-AzureSqlDatabase [-ConnectionContext] [-Database] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Remove-AzureSqlDatabase [-ConnectionContext] [-DatabaseName] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Remove-AzureSqlDatabase [-ServerName] [-DatabaseName] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Remove-AzureSqlDatabase [-ServerName] [-Database] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Detailed Description

The Remove-AzureSqlDatabase cmdlet deletes a SQL Database from the SQL Database Server specified by connection context or server name. You can create a SQL Database Server connection context using the New-AzureSqlDatabaseServerContext cmdlet, and then use it with this cmdlet. When you delete a database by specifying a SQL Database Server name, the Remove-AzureSqlDatabase cmdlet uses the name and the current Azure subscription information to perform the operation.

Parameters

-ConnectionContext <IServerDataServiceContext>

The connection context to a SQL Database Server where you want to delete a SQL Database.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Database <Database>

A database object representing the database to be removed.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-Force <SwitchParameter>

Allows the action to complete without prompting the user for confirmation.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

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

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-DatabaseName <String>

The name of the SQL Database to be removed.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ServerName <String>

The name of SQL Database Server where you want to delete the database.

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


Notes

Because of the severity of the operation, this cmdlet prompts the user for confirmation by default. This can be overridden by using the -Force parameter.

Examples

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

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

PS C:\> C:\PS>Remove-AzureSqlDatabase -ConnectionContext $ctx -DatabaseName "Database1"

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

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

PS C:\> C:\PS>Remove-AzureSqlDatabase -ServerName "lpqd0zbr8y" -DatabaseName "Database1"

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

This example demonstrates the alternative method of passing the database object through the pipeline.

PS C:\> C:\PS>$database1 | Remove-AzureSqlDatabase -ConnectionContext $ctx
C:\PS>$database1 | Remove-AzureSqlDatabase -ServerName "lpqd0zbr8y"

Get-AzureSqlDatabase
New-AzureSqlDatabase
New-AzureSqlDatabaseServerContext
Set-AzureSqlDatabase