Edit

Get-AzSqlDeletedServer

Gets information about soft-deleted Azure SQL servers. (Server soft-delete feature is currently in Public Preview)

Syntax

Default (Default)

Get-AzSqlDeletedServer
    [[-Location] <String>]
    [-ServerName <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzSqlDeletedServer cmdlet returns information about one or more deleted Azure SQL servers in a subscription. Specify -Location to scope results to a region, specify -ServerName without -Location to filter subscription-level results by server name, or specify both parameters to retrieve a single deleted server.

Examples

Example 1: Get all deleted servers in a location

Get-AzSqlDeletedServer -Location "centralus"
ServerName                : myserver
Location                  : centralus
DeletionTime              : 11/6/2025 12:30:00 PM
FullyQualifiedDomainName  : myserver.database.windows.net
Version                   : 12.0
Id                        : /subscriptions/12345678-1234-1234-1234-123456789012/providers/Microsoft.Sql/locations/centralus/deletedServers/myserver
OriginalId                : /subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver
ScheduledPurgeTime        : 11/13/2025 12:30:00 PM
ResourceGroupName         : myresourcegroup
SubscriptionId            : 12345678-1234-1234-1234-123456789012

This command gets all deleted SQL servers in the Central US location under the current subscription.

Example 2: Get all deleted servers in a subscription

Get-AzSqlDeletedServer

This command gets all deleted SQL servers under the current subscription.

Example 3: Get a specific deleted server

Get-AzSqlDeletedServer -Location "centralus" -ServerName "myserver"
ServerName                : myserver
Location                  : centralus
DeletionTime              : 11/6/2025 12:30:00 PM
FullyQualifiedDomainName  : myserver.database.windows.net
Version                   : 12.0
Id                        : /subscriptions/12345678-1234-1234-1234-123456789012/providers/Microsoft.Sql/locations/centralus/deletedServers/myserver
OriginalId                : /subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver
ScheduledPurgeTime        : 11/13/2025 12:30:00 PM
ResourceGroupName         : myresourcegroup
SubscriptionId            : 12345678-1234-1234-1234-123456789012

This command gets information about a specific deleted SQL server named "myserver" in the Central US location.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Location

The Azure region where the deleted server was located.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ServerName

The name of the deleted server to retrieve. Without -Location, the cmdlet filters deleted servers across the current subscription by this name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Outputs

AzureSqlDeletedServerModel