New-AzVpnConnection
Skapar en IPSec-anslutning som ansluter en VpnGateway till en fjärrkundsgren som representeras i RM som en VpnSite.
Syntax
New-AzVpnConnection
-ResourceGroupName <String>
-ParentResourceName <String>
-Name <String>
-VpnSite <PSVpnSite>
[-SharedKey <SecureString>]
[-ConnectionBandwidthInMbps <UInt32>]
[-IpSecPolicy <PSIpsecPolicy>]
[-VpnConnectionProtocolType <String>]
[-EnableBgp]
[-UseLocalAzureIpAddress]
[-UsePolicyBasedTrafficSelectors]
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>]
[-EnableInternetSecurity]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVpnConnection
-ResourceGroupName <String>
-ParentResourceName <String>
-Name <String>
-VpnSiteId <String>
[-SharedKey <SecureString>]
[-ConnectionBandwidthInMbps <UInt32>]
[-IpSecPolicy <PSIpsecPolicy>]
[-VpnConnectionProtocolType <String>]
[-EnableBgp]
[-UseLocalAzureIpAddress]
[-UsePolicyBasedTrafficSelectors]
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>]
[-EnableInternetSecurity]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVpnConnection
-ParentObject <PSVpnGateway>
-Name <String>
-VpnSite <PSVpnSite>
[-SharedKey <SecureString>]
[-ConnectionBandwidthInMbps <UInt32>]
[-IpSecPolicy <PSIpsecPolicy>]
[-VpnConnectionProtocolType <String>]
[-EnableBgp]
[-UseLocalAzureIpAddress]
[-UsePolicyBasedTrafficSelectors]
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>]
[-EnableInternetSecurity]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVpnConnection
-ParentObject <PSVpnGateway>
-Name <String>
-VpnSiteId <String>
[-SharedKey <SecureString>]
[-ConnectionBandwidthInMbps <UInt32>]
[-IpSecPolicy <PSIpsecPolicy>]
[-VpnConnectionProtocolType <String>]
[-EnableBgp]
[-UseLocalAzureIpAddress]
[-UsePolicyBasedTrafficSelectors]
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>]
[-EnableInternetSecurity]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVpnConnection
-ParentResourceId <String>
-Name <String>
-VpnSite <PSVpnSite>
[-SharedKey <SecureString>]
[-ConnectionBandwidthInMbps <UInt32>]
[-IpSecPolicy <PSIpsecPolicy>]
[-VpnConnectionProtocolType <String>]
[-EnableBgp]
[-UseLocalAzureIpAddress]
[-UsePolicyBasedTrafficSelectors]
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>]
[-EnableInternetSecurity]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVpnConnection
-ParentResourceId <String>
-Name <String>
-VpnSiteId <String>
[-SharedKey <SecureString>]
[-ConnectionBandwidthInMbps <UInt32>]
[-IpSecPolicy <PSIpsecPolicy>]
[-VpnConnectionProtocolType <String>]
[-EnableBgp]
[-UseLocalAzureIpAddress]
[-UsePolicyBasedTrafficSelectors]
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>]
[-EnableInternetSecurity]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Skapar en IPSec-anslutning som ansluter en VpnGateway till en fjärrkundsgren som representeras i RM som en VpnSite.
Exempel
Exempel 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"
$vpnSite = New-AzVpnSite -ResourceGroupName "testRG" -Name "testVpnSite" -Location "West US" -VirtualWan $virtualWan -IpAddress "1.2.3.4" -AddressSpace $vpnSiteAddressSpaces -DeviceModel "SomeDevice" -DeviceVendor "SomeDeviceVendor" -LinkSpeedInMbps "10"
New-AzVpnConnection -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testConnection" -VpnSite $vpnSite -ConnectionBandwidthInMbps 20
RemoteVpnSite : Microsoft.Azure.Commands.Network.Models.PSResourceId
SharedKey :
VpnConnectionProtocolType : IKEv2
ConnectionStatus :
EgressBytesTransferred : 0
IngressBytesTransferred : 0
IpsecPolicies : {}
ConnectionBandwidth : 20
EnableBgp : False
UseLocalAzureIpAddress : False
ProvisioningState : testConnection
Name : ps9709
Etag : W/"4580a2e2-2fab-4cff-88eb-92013a76b5a8"
Id : /subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/vpnGateways/testvpngw/vpnConnections/testConnection
RoutingConfiguration : {
"AssociatedRouteTable": {
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
"PropagatedRouteTables": {
"Labels": [],
"Ids": [
{
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
]
},
"VnetRoutes": {
"StaticRoutes": []
}
}
Ovanstående skapar en resursgrupp, Virtual WAN, Virtual Network, Virtual Hub och en VpnSite i USA, västra i resursgruppen "testRG" i Azure. Därefter skapas en VPN-gateway i den virtuella hubben med två skalningsenheter.
När gatewayen har skapats ansluts den till VpnSite med kommandot New-AzVpnConnection.
Exempel 2
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"
$vpnSiteLink1 = New-AzVpnSiteLink -Name "testVpnSiteLink1" -IpAddress "15.25.35.45" -LinkProviderName "SomeTelecomProvider" -LinkSpeedInMbps "10"
$vpnSiteLink2 = New-AzVpnSiteLink -Name "testVpnSiteLink2" -IpAddress "15.25.35.55" -LinkProviderName "SomeTelecomProvider2" -LinkSpeedInMbps "100"
$vpnSite = New-AzVpnSite -ResourceGroupName "testRG" -Name "testVpnSite" -Location "West US" -VirtualWan $virtualWan -AddressSpace $vpnSiteAddressSpaces -DeviceModel "SomeDevice" -DeviceVendor "SomeDeviceVendor" -VpnSiteLink @($vpnSiteLink1, $vpnSiteLink2)
$vpnSiteLinkConnection1 = New-AzVpnSiteLinkConnection -Name "testLinkConnection1" -VpnSiteLink $vpnSite.VpnSiteLinks[0] -ConnectionBandwidth 100
$vpnSiteLinkConnection2 = New-AzVpnSiteLinkConnection -Name "testLinkConnection2" -VpnSiteLink $vpnSite.VpnSiteLinks[1] -ConnectionBandwidth 10
New-AzVpnConnection -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testConnection" -VpnSite $vpnSite -VpnSiteLinkConnection @($vpnSiteLinkConnection1, $vpnSiteLinkConnection2)
Ovanstående skapar en resursgrupp, Virtual WAN, Virtual Network, Virtual Hub och en VpnSite med 1 VpnSiteLinks i USA, västra i resursgruppen "testRG" i Azure. Därefter skapas en VPN-gateway i den virtuella hubben. När gatewayen har skapats ansluts den till VpnSite med kommandot New-AzVpnConnection med 1 VpnSiteLinkConnections till VpnSiteLink för VpnSite.
Parametrar
-AsJob
Kör cmdlet i bakgrunden
Typ: | SwitchParameter |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-Confirm
Uppmanar dig att bekräfta innan du kör cmdleten.
Typ: | SwitchParameter |
Alias: | cf |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-ConnectionBandwidthInMbps
Den bandbredd som måste hanteras av den här anslutningen i mbit/s.
Typ: | UInt32 |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-DefaultProfile
Autentiseringsuppgifter, konto, klientorganisation och prenumeration som används för kommunikation med Azure.
Typ: | IAzureContextContainer |
Alias: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-EnableBgp
Aktivera BGP för den här anslutningen
Typ: | SwitchParameter |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-EnableInternetSecurity
Aktivera Internetsäkerhet för den här anslutningen
Typ: | SwitchParameter |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-IpSecPolicy
Den bandbredd som måste hanteras av den här anslutningen i mbit/s.
Typ: | PSIpsecPolicy |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-Name
Resursnamnet.
Typ: | String |
Alias: | ResourceName, VpnConnectionName |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | True |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-ParentObject
Den överordnade VpnGateway för den här anslutningen.
Typ: | PSVpnGateway |
Alias: | ParentVpnGateway, VpnGateway |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | True |
Godkänn pipeline-indata: | True |
Godkänn jokertecken: | False |
-ParentResourceId
Resurs-ID för den överordnade VpnGateway för den här anslutningen.
Typ: | String |
Alias: | ParentVpnGatewayId, VpnGatewayId |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | True |
Godkänn pipeline-indata: | True |
Godkänn jokertecken: | False |
-ParentResourceName
Resursgruppens namn.
Typ: | String |
Alias: | ParentVpnGatewayName, VpnGatewayName |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | True |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-ResourceGroupName
Resursgruppens namn.
Typ: | String |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | True |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-RoutingConfiguration
Routningskonfiguration för den här anslutningen
Typ: | PSRoutingConfiguration |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-SharedKey
Den delade nyckel som krävs för att konfigurera den här anslutningen.
Typ: | SecureString |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-TrafficSelectorPolicy
En lista över principer för trafikväljare.
Typ: | PSTrafficSelectorPolicy[] |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | True |
Godkänn jokertecken: | False |
-UseLocalAzureIpAddress
Använd lokal azure ip-adress som källadress när du initierar anslutningen.
Typ: | SwitchParameter |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-UsePolicyBasedTrafficSelectors
Använd principbaserade trafikväljare för den här anslutningen.
Typ: | SwitchParameter |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-VpnConnectionProtocolType
Protokoll för gatewayanslutning:IKEv1/IKEv2
Typ: | String |
Godkända värden: | IKEv1, IKEv2 |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-VpnSite
Den fjärr-VPN-plats som den här virtuella hubbanslutningen är ansluten till.
Typ: | PSVpnSite |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | True |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-VpnSiteId
Den fjärr-VPN-plats som den här virtuella hubbanslutningen är ansluten till.
Typ: | String |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | True |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-VpnSiteLinkConnection
Listan över VpnSiteLinkConnections som denna VpnConnection har.
Typ: | PSVpnSiteLinkConnection[] |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
-WhatIf
Visar vad som skulle hända om cmdleten kördes. Cmdleten körs inte.
Typ: | SwitchParameter |
Alias: | wi |
Position: | Named |
Standardvärde: | None |
Obligatorisk: | False |
Godkänn pipeline-indata: | False |
Godkänn jokertecken: | False |
Indata
Utdata
Relaterade länkar
Azure PowerShell