Remove-AzureSqlDatabase

Deletes an Azure SQL Database.

Syntax

Remove-AzureSqlDatabase
      -ConnectionContext <IServerDataServiceContext>
      -DatabaseName <String>
      [-Force]
      [-Profile <AzureSMProfile>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureSqlDatabase
      -ConnectionContext <IServerDataServiceContext>
      -Database <Database>
      [-Force]
      [-Profile <AzureSMProfile>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureSqlDatabase
      -ServerName <String>
      -DatabaseName <String>
      [-Force]
      [-Profile <AzureSMProfile>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureSqlDatabase
      -ServerName <String>
      -Database <Database>
      [-Force]
      [-Profile <AzureSMProfile>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzureSqlDatabase cmdlet deletes an Azure SQL Database by server connection context or server name. You can create an Azure SQL Database server connection context using the New-AzureSqlDatabaseServerContext cmdlet, and then use it with this cmdlet.

When you delete a database by specifying an Azure SQL Database server name, the Remove-AzureSqlDatabase cmdlet uses the name and the current Azure subscription information to perform the operation.

Examples

Example 1: Remove a database

PS C:\> Remove-AzureSqlDatabase -ConnectionContext $Context -DatabaseName "Database01"

This command removes the database named Database01 from the Azure SQL Database server connection context $Context.

Example 2: Remove a database by using a server name

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

This command removes the database named Database01 from the Azure SQL Database server namedlpqd0zbr8y.

Example 3: Remove a database by using the pipeline

PS C:\> $Database01 | Remove-AzureSqlDatabase -ConnectionContext $Context
PS C:\> $Database01 | Remove-AzureSqlDatabase -ServerName "lpqd0zbr8y"

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

Required Parameters

-ConnectionContext

Specifies the connection context of a server from which this cmdlet removes a database.

Type:IServerDataServiceContext
Aliases:Context
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Database

Specifies an object that represents the database that this cmdlet removes.

Type:Database
Aliases:InputObject
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-DatabaseName

Specifies the name of the database that this cmdlet removes.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServerName

Specifies the name of the server on which this cmdlet deletes the database.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Force

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

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Accept pipeline input:False
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
Accept pipeline input:False
Accept wildcard characters:False

Inputs

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

Notes