Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Remove-AzSqlInstanceLink

Module:
Az.Sql Module

Removes an instance link.

Syntax

DeleteByNameParameterSet (Default)

Remove-AzSqlInstanceLink
 [-ResourceGroupName] <String>
 [-InstanceName] <String>
 [-Name] <String>
 [-Force]
 [-PassThru]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

DeleteByParentObjectParameterSet

Remove-AzSqlInstanceLink
 [-Name] <String>
 [-InstanceObject] <AzureSqlManagedInstanceModel>
 [-Force]
 [-PassThru]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

DeleteByInputObjectParameterSet

Remove-AzSqlInstanceLink
 [-InputObject] <AzureSqlManagedInstanceLinkModel>
 [-Force]
 [-PassThru]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

DeleteByResourceIdParameterSet

Remove-AzSqlInstanceLink
 [-ResourceId] <String>
 [-Force]
 [-PassThru]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

Description

Remove-AzSqlInstanceLink cmdlet drops an instance link. This command may cause data loss if the link is dropped and replica's LSNs are not synchronized with the primary, thus user must explicitly confirm the command when prompted, or use -Force parameter.

Examples

Example 1: Remove instance link

Remove-AzSqlInstanceLink -ResourceGroupName "ResourceGroup01" -InstanceName "ManagedInstance01" -Name "Link01"
This operation may cause data loss if replica's last hardened LSN is not in sync with the primary. Are you sure you want to proceed?
[Y] Yes [N] No [?] Help (default is "Y"): Y

This command removes the instance link "Link01" from the managed instance "ManagedInstance01".

Example 2: Remove instance link with an explicit -Force flag

Remove-AzSqlInstanceLink -ResourceGroupName "ResourceGroup01" -InstanceName "ManagedInstance01" -Name "Link01" -Force

This command forcefully removes the instance link "Link01" from the managed instance "ManagedInstance01", ignoring the data loss warning.

Example 3: Remove instance link by its resource identifier

Remove-AzSqlInstanceLink -ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourcegroup01/providers/Microsoft.Sql/managedInstances/ManagedInstance01/distributedAvailabilityGroups/Link01"
This operation may cause data loss if replica's last hardened LSN is not in sync with the primary. Are you sure you want to proceed?
[Y] Yes [N] No [?] Help (default is "Y"): Y

This command removes the instance link with specified resource ID.

Example 4: Remove instance link by its PowerShell object

$managedInstanceLink = Get-AzSqlInstanceLink -ResourceGroupName "ResourceGroup01" -InstanceName "ManagedInstance01" -Name "Link01"
Remove-AzSqlInstanceLink -InputObject $managedInstanceLink
This operation may cause data loss if replica's last hardened LSN is not in sync with the primary. Are you sure you want to proceed?
[Y] Yes [N] No [?] Help (default is "Y"): Y

This command removes the instance link specified by instance link object.

Example 5: Remove instance link by its parent instance object

$instance = Get-AzSqlInstance -ResourceGroupName "ResourceGroup01" -Name "ManagedInstance01"
Remove-AzSqlInstanceLink -InstanceObject $instance -Name "Link01"
This operation may cause data loss if replica's last hardened LSN is not in sync with the primary. Are you sure you want to proceed?
[Y] Yes [N] No [?] Help (default is "Y"): Y

This command removes the instance link "Link01" from the managed instance specified by the instance object.

Example 6: Remove instance link using positional parameters

Remove-AzSqlInstanceLink "ResourceGroup01" "ManagedInstance01" "Link01"
This operation may cause data loss if replica's last hardened LSN is not in sync with the primary. Are you sure you want to proceed?
[Y] Yes [N] No [?] Help (default is "Y"): Y

This command removes the instance link "Link01" from the managed instance "ManagedInstance01" using positional parameters.

Example 7: Remove all instance links from its parent instance by piping link objects

$instance = Get-AzSqlInstance -ResourceGroupName "ResourceGroup01" -Name "ManagedInstance01"
$instance | Get-AzSqlInstanceLink | Remove-AzSqlInstanceLink -Force

This command removes all instance links from the managed instance "ManagedInstance01".

Example 8: Remove instance link with an explicit -Force flag and output the deleted instance link object

Remove-AzSqlInstanceLink -ResourceGroupName "ResourceGroup01" -InstanceName "ManagedInstance01" -Name "Link01" -Force -PassThru
This operation may cause data loss if replica's last hardened LSN is not in sync with the primary. Are you sure you want to proceed?
[Y] Yes [N] No [?] Help (default is "Y"): Y

This command removes an instance link from the managed instance "ManagedInstance01" and outputs the deleted instance link object.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-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

-Force

Skip confirmation message for performing the action.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AllowDataLoss

Parameter sets

-InputObject

Instance link input object.

Parameter properties

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

Parameter sets

-InstanceName

Name of the managed instance.

Parameter properties

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

Parameter sets

-InstanceObject

Instance input object.

Parameter properties

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

Parameter sets

-Name

Managed Instance link name.

Parameter properties

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

Parameter sets

-PassThru

Defines whether to return the removed instance link.

Parameter properties

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

Parameter sets

-ResourceGroupName

Name of the resource group.

Parameter properties

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

Parameter sets

-ResourceId

The instance link resource ID.

Parameter properties

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

Parameter sets

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

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

AzureSqlManagedInstanceModel

AzureSqlManagedInstanceLinkModel

String

Outputs

AzureSqlManagedInstanceLinkModel

Related Links


Feedback

Was this page helpful?