Remove-AzSqlServer

This cmdlet removes an Azure SQL Server.

Syntax

Remove-AzSqlServer
    [-Name -string]
    [-ResourceGroupName -string]
    [-Force]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [-CommonParameters]
                    

Parameters

Name Description Type Required
-Name Specifies the name of the SQL Server to remove. System.String True
-ResourceGroupName Specifies the name of the resource group that contains the SQL Server. System.String True
-Force Forces the command to run without asking for confirmation. System.Management.Automation.SwitchParameter False
-AsJob Runs the cmdlet as a background job. Use this cmdlet to send and start the commands as a background job. System.Management.Automation.SwitchParameter False
-WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run. System.Management.Automation.SwitchParameter False
-Confirm Prompts you for confirmation before running the cmdlet. System.Management.Automation.SwitchParameter False

Examples

Example 1: Remove a SQL Server

Remove-AzSqlServer -ResourceGroupName "ResourceGroup01" -Name "Server01"
                        

This command removes the SQL Server named "Server01" from the resource group "ResourceGroup01".

Example 2: Remove a SQL Server without confirmation

Remove-AzSqlServer -ResourceGroupName "ResourceGroup01" -Name "Server01" -Force
                        

This command removes the SQL Server named "Server01" from the resource group "ResourceGroup01" without prompting for confirmation.

Notes

This cmdlet is part of the Az.SqlServer module. Make sure you have the latest version installed.

When you remove a SQL Server, all databases and other related resources are also deleted.

Related Links