Upravit

Sdílet prostřednictvím


New-AzVpnSiteLinkConnection

Creates an Azure VpnSiteLinkConnection object.

Syntax

New-AzVpnSiteLinkConnection
   -Name <String>
   -VpnSiteLink <PSVpnSiteLink>
   [-SharedKey <SecureString>]
   [-ConnectionBandwidth <UInt32>]
   [-RoutingWeight <UInt32>]
   [-IpSecPolicy <PSIpsecPolicy>]
   [-VpnConnectionProtocolType <String>]
   [-EnableBgp]
   [-UseLocalAzureIpAddress]
   [-UsePolicyBasedTrafficSelectors]
   [-IngressNatRule <PSResourceId[]>]
   [-EgressNatRule <PSResourceId[]>]
   [-VpnGatewayCustomBgpAddress <PSGatewayCustomBgpIpConfiguration[]>]
   [-VpnLinkConnectionMode <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Creates an Azure VpnSiteLinkConnection object.

Examples

Example 1

New-AzResourceGroup -Location "West US" -Name "testRG"
$virtualWan = New-AzVirtualWan -ResourceGroupName testRG -Name myVirtualWAN -Location "West US"
$virtualHub = New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.0.1/24"
New-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -VirtualHubId $virtualHub.Id -VpnGatewayScaleUnit 2
$vpnGateway = Get-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw"

$vpnSiteAddressSpaces = New-Object string[] 2
$vpnSiteAddressSpaces[0] = "192.168.2.0/24"
$vpnSiteAddressSpaces[1] = "192.168.3.0/24"

$vpnSiteLink = New-AzVpnSiteLink -Name "testVpnSiteLink1" -IpAddress "15.25.35.45" -LinkProviderName "SomeTelecomProvider" -LinkSpeedInMbps "10"
$vpnSite = New-AzVpnSite -ResourceGroupName "testRG" -Name "testVpnSite" -Location "West US" -VirtualWan $virtualWan -AddressSpace $vpnSiteAddressSpaces -DeviceModel "SomeDevice" -DeviceVendor "SomeDeviceVendor" -VpnSiteLink @($vpnSiteLink)


$vpnSiteLinkConnection = New-AzVpnSiteLinkConnection -Name "testLinkConnection1" -VpnSiteLink $vpnSite.VpnSiteLinks[0] -ConnectionBandwidth 100

New-AzVpnConnection -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testConnection" -VpnSite $vpnSite -VpnSiteLinkConnection @($vpnSiteLinkConnection)

The above will create a resource group, Virtual WAN, Virtual Network, Virtual Hub and a VpnSite with 1 VpnSiteLinks in West US in "testRG" resource group in Azure. A VPN gateway will be created thereafter in the Virtual Hub. Once the gateway has been created, it is connected to the VpnSite using the New-AzVpnConnection command with 1 VpnSiteLinkConnections to the VpnSiteLink of the VpnSite.

Example 2 VpnGatewayCustomBgpAddress

$vpnSite = Get-AzVpnSite -ResourceGroupName PS_testing -Name testsite
$vpnGateway = Get-AzVpnGateway -ResourceGroupName PS_testing -Name 196ddf92afae40e4b20edc32dfb48a63-eastus-gw

$address = New-AzGatewayCustomBgpIpConfigurationObject -IpConfigurationId "Instance0" -CustomBgpIpAddress "169.254.22.1"
$address2 = New-AzGatewayCustomBgpIpConfigurationObject -IpConfigurationId "Instance1" -CustomBgpIpAddress "169.254.22.3"

$vpnSiteLinkConnection = New-AzVpnSiteLinkConnection -Name "testLinkConnection1" -VpnSiteLink $vpnSite.VpnSiteLinks[0] -ConnectionBandwidth 100 -VpnGatewayCustomBgpAddress $address,$address2 -EnableBgp

New-AzVpnConnection -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testConnection" -VpnSite $vpnSite -VpnSiteLinkConnection @($vpnSiteLinkConnection)

The above will create AzGatewayCustomBgpIpConfigurationObject 1 VpnSiteLinks with VpnConnection in "PS_testing" resource group in Azure. Once connection is created, it is connected to the VpnSite using the New-AzVpnConnection command with 1 VpnSiteLinkConnections to the VpnSiteLink of the VpnSite. This connection will use provided GatewayCustomBgpIpAddress for Bgp connection at VpnGateway side.

Parameters

-ConnectionBandwidth

The bandwidth that needs to be handled by this link connection in mbps.

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

-EgressNatRule

The list of egress NAT rules that are associated with this link Connection.

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

-EnableBgp

Enable BGP for this link connection

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

-IngressNatRule

The list of ingress NAT rules that are associated with this link Connection.

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

-IpSecPolicy

IpSec Policy to be considered for this link connection.

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

-Name

VpnSiteLinkConnection Name

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

-RoutingWeight

Routing Weight

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

-SharedKey

The shared key required to set this link connection up.

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

-UseLocalAzureIpAddress

Use local azure ip address as source ip for this link connection.

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

-UsePolicyBasedTrafficSelectors

Use policy based traffic selectors for this link connection.

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

-VpnConnectionProtocolType

Gateway connection protocol:IKEv1/IKEv2

Type:String
Accepted values:IKEv1, IKEv2
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VpnGatewayCustomBgpAddress

The GatewayCustomBgpIpAddress of Vpngateway used in this link connection.

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

-VpnLinkConnectionMode

The connection mode for this link connection.

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

The vpn site link object to connect to.

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

Inputs

PSVpnSiteLink

PSGatewayCustomBgpIpConfiguration[]

Outputs

PSVpnSiteLinkConnection