Redigera

Dela via


Remove-AzSqlInstanceLink

Removes an instance link.

Syntax

Remove-AzSqlInstanceLink
      [-ResourceGroupName] <String>
      [-InstanceName] <String>
      [-Name] <String>
      [-Force]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzSqlInstanceLink
      [-Name] <String>
      [-InstanceObject] <AzureSqlManagedInstanceModel>
      [-Force]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzSqlInstanceLink
      [-InputObject] <AzureSqlManagedInstanceLinkModel>
      [-Force]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
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

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".

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.

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.

$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.

$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.

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.

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

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

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

ResourceGroupName              : ResourceGroup01
InstanceName                   : ManagedInstance01
Type                           : Microsoft.Sql/managedInstances/distributedAvailabilityGroups
Id                             : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ResourceGroup01/providers/Microsoft.Sql/managedInstances/ManagedInstance01/distributedAvailabilityGroups/Link01
Name                           : Link01
TargetDatabase                 : Database01
SourceEndpoint                 : TCP://SERVER01:5022
PrimaryAvailabilityGroupName   :
SecondaryAvailabilityGroupName :
ReplicationMode                : Async
DistributedAvailabilityGroupId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
SourceReplicaId                : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
TargetReplicaId                : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
LinkState                      : Copying
LastHardenedLsn                :

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.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Skip confirmation message for performing the action.

Type:SwitchParameter
Aliases:AllowDataLoss
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Instance link input object.

Type:AzureSqlManagedInstanceLinkModel
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-InstanceName

Name of Azure SQL Managed Instance.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InstanceObject

Instance input object.

Type:AzureSqlManagedInstanceModel
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Name of the instance link.

Type:String
Aliases:LinkName
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Defines whether to return the removed instance link.

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

-ResourceGroupName

Name of the resource group.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

The instance link resource ID.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
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:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

AzureSqlManagedInstanceModel

AzureSqlManagedInstanceLinkModel

String

Outputs

AzureSqlManagedInstanceLinkModel