Redigera

Dela via


New-AzSqlInstanceLink

Creates a new instance link.

Syntax

New-AzSqlInstanceLink
   [-ResourceGroupName] <String>
   [-InstanceName] <String>
   [-Name] <String>
   -PartnerAvailabilityGroupName <String>
   -InstanceAvailabilityGroupName <String>
   -Database <String[]>
   -PartnerEndpoint <String>
   [-FailoverMode <String>]
   [-InstanceLinkRole <String>]
   [-SeedingMode <String>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzSqlInstanceLink
   [-Name] <String>
   -PartnerAvailabilityGroupName <String>
   -InstanceAvailabilityGroupName <String>
   -Database <String[]>
   -PartnerEndpoint <String>
   [-FailoverMode <String>]
   [-InstanceLinkRole <String>]
   [-SeedingMode <String>]
   [-InstanceObject] <AzureSqlManagedInstanceModel>
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzSqlInstanceLink cmdlet creates an Managed Instance link by joining distributed availability group on SQL Server based on the parameters passed.

Examples

New-AzSqlInstanceLink -ResourceGroupName "ResourceGroup01" -InstanceName "ManagedInstance01" -Name "Link01" -Database "Database01" -InstanceAvailabilityGroupName "AG_Database01_MI" -PartnerAvailabilityGroupName "AG_Database01" -InstanceLinkRole "Secondary" -PartnerEndpoint "TCP://SERVER01:5022" -FailoverMode "Manual" -SeedingMode "Automatic"

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
DistributedAvailabilityGroupName : Link01
DistributedAvailabilityGroupId   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Databases                        : {Database01}
InstanceAvailabilityGroupName    : AG_Database01_MI
PartnerAvailabilityGroupName     : AG_Database01
PartnerEndpoint                  : TCP://SERVER01:5022
InstanceLinkRole                 : Secondary
PartnerLinkRole                  : Primary
ReplicationMode                  : Async
FailoverMode                     : Manual
SeedingMode                      : Automatic

This command creates a new instance link with name "Link01".

$instance = Get-AzSqlInstance -ResourceGroupName "ResourceGroup01" -Name "ManagedInstance01"
New-AzSqlInstanceLink -InstanceObject $instance -Name "Link01" -Database "Database01" -InstanceAvailabilityGroupName "AG_Database01_MI" -PartnerAvailabilityGroupName "AG_Database01" -InstanceLinkRole "Secondary" -PartnerEndpoint "TCP://SERVER01:5022" -FailoverMode "Manual" -SeedingMode "Automatic"

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
DistributedAvailabilityGroupName : Link01
DistributedAvailabilityGroupId   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Databases                        : {Database01}
InstanceAvailabilityGroupName    : AG_Database01_MI
PartnerAvailabilityGroupName     : AG_Database01
PartnerEndpoint                  : TCP://SERVER01:5022
InstanceLinkRole                 : Secondary
PartnerLinkRole                  : Primary
ReplicationMode                  : Async
FailoverMode                     : Manual
SeedingMode                      : Automatic

This command creates a new instance link using a managed instance object as a parameter.

$instance = Get-AzSqlInstance -ResourceGroupName "ResourceGroup01" -Name "ManagedInstance01"
$instance | New-AzSqlInstanceLink -Name "Link01" -Database "Database01" -InstanceAvailabilityGroupName "AG_Database01_MI" -PartnerAvailabilityGroupName "AG_Database01" -InstanceLinkRole "Secondary" -PartnerEndpoint "TCP://SERVER01:5022" -FailoverMode "Manual" -SeedingMode "Automatic"

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
DistributedAvailabilityGroupName : Link01
DistributedAvailabilityGroupId   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Databases                        : {Database01}
InstanceAvailabilityGroupName    : AG_Database01_MI
PartnerAvailabilityGroupName     : AG_Database01
PartnerEndpoint                  : TCP://SERVER01:5022
InstanceLinkRole                 : Secondary
PartnerLinkRole                  : Primary
ReplicationMode                  : Async
FailoverMode                     : Manual
SeedingMode                      : Automatic

This command creates a new instance link by piping an instance object.

Parameters

-AsJob

Run cmdlet in the background.

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

-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

-Database

Database names in the distributed availability group.

Type:String[]
Position:Named
Default value:None
Required:True
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

-FailoverMode

The link failover mode - can be Manual if intended to be used for two-way failover with a supported SQL Server, or None for one-way failover to Azure.

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

-InstanceAvailabilityGroupName

Managed instance side availability group name.

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

-InstanceLinkRole

Managed instance side link role.

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

-InstanceName

Name of the 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

Managed Instance link name.

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

-PartnerAvailabilityGroupName

SQL server side availability group name.

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

-PartnerEndpoint

SQL server side endpoint - IP or DNS resolvable name.

Type:String
Position:Named
Default value:None
Required:True
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

-SeedingMode

Database seeding mode � can be Automatic (default), or Manual for supported scenarios.

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

Inputs

AzureSqlManagedInstanceModel

Outputs

AzureSqlManagedInstanceLinkModel