New-AzAvailabilityGroupListener

Creates or updates an availability group listener.

Syntax

New-AzAvailabilityGroupListener
   -Name <String>
   -ResourceGroupName <String>
   -SqlVMGroupName <String>
   [-SubscriptionId <String>]
   [-AvailabilityGroupConfigurationReplica <IAgReplica[]>]
   [-AvailabilityGroupName <String>]
   [-CreateDefaultAvailabilityGroupIfNotExist]
   [-IpAddress <String>]
   [-LoadBalancerResourceId <String>]
   [-ProbePort <Int32>]
   [-PublicIpAddressResourceId <String>]
   [-SqlVirtualMachineId <String[]>]
   [-SubnetId <String>]
   [-MultiSubnetIPConfiguration <IMultiSubnetIPConfiguration[]>]
   [-Port <Int32>]
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Creates or updates an availability group listener.

Examples

Example 1

New-AzAvailabilityGroupListener -ResourceGroupName 'ResourceGroup01' -SqlVMGroupName 'sqlvmgroup01' -Name 'AgListener01' -AvailabilityGroupName 'AG01' -IpAddress '192.168.16.7' -LoadBalancerResourceId $LoadBalancerResourceId -SubnetId $SubnetResourceId -ProbePort 9999 -SqlVirtualMachineId $sqlvmResourceId1,$sqlvmResourceId2

Name         ResourceGroupName
----         -----------------
AgListener01 ResourceGroup01

Create a new Availability Group Listener "AgListener01" with Load Balancer Configuration for the Availability Group "AG01" in SQL Virtual Machine Group "sqlvmgroup01".

Example 2

$msconfig1 = New-AzSqlVirtualMachineMultiSubnetIPConfigurationObject -PrivateIPAddressSubnetResourceId $SubnetResourceId1 -PrivateIPAddressIpaddress '192.168.16.9' -SqlVirtualMachineInstance $sqlvmResourceId1
$msconfig2 = New-AzSqlVirtualMachineMultiSubnetIPConfigurationObject -PrivateIPAddressSubnetResourceId $SubnetResourceId2 -PrivateIPAddressIpaddress '192.168.17.9' -SqlVirtualMachineInstance $sqlvmResourceId2

New-AzAvailabilityGroupListener -Name 'AgListener02' -ResourceGroupName 'ResourceGroup01' -SqlVMGroupName 'sqlvmgroup01' -AvailabilityGroupName 'AG02' -MultiSubnetIPConfiguration $msconfig1,$msconfig2

Name         ResourceGroupName
----         -----------------
AgListener02 ResourceGroup01

Create a new Availability Group Listener "AgListener02" with Multi Subnets Configuration for the Availability Group "AG02" in SQL Virtual Machine Group "sqlvmgroup01".

Parameters

-AsJob

Run the command as a job

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

-AvailabilityGroupConfigurationReplica

Replica configurations. To construct, see NOTES section for AVAILABILITYGROUPCONFIGURATIONREPLICA properties and create a hash table.

Type:IAgReplica[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AvailabilityGroupName

Name of the availability group.

Type:String
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

-CreateDefaultAvailabilityGroupIfNotExist

Create a default availability group if it does not exist.

Type:SwitchParameter
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:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IpAddress

Private IP address bound to the availability group listener.

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

-LoadBalancerResourceId

Resource id of the load balancer.

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

-MultiSubnetIPConfiguration

List of multi subnet IP configurations for an AG listener. To construct, see NOTES section for MULTISUBNETIPCONFIGURATION properties and create a hash table.

Type:IMultiSubnetIPConfiguration[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Name of the availability group listener.

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

-NoWait

Run the command asynchronously

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

-Port

Listener port.

Type:Int32
Position:Named
Default value:1433
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProbePort

Probe port.

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

-PublicIpAddressResourceId

Resource id of the public IP.

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

-ResourceGroupName

Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

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

-SqlVirtualMachineId

List of the SQL virtual machine instance resource id's that are enrolled into the availability group listener.

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

-SqlVMGroupName

Name of the SQL virtual machine group.

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

-SubnetId

Subnet used to include private IP.

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

-SubscriptionId

Subscription ID that identifies an Azure subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
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

Outputs

IAvailabilityGroupListener