< Back

New-AzureRmVirtualNetworkGateway

Tue Jan 29, 2019 9:56 pm

NAME New-AzureRmVirtualNetworkGateway



SYNOPSIS

Creates a Virtual Network Gateway





SYNTAX

New-AzureRmVirtualNetworkGateway [-AsJob] [-Asn <UInt32>] [-DefaultProfile <IAzureContextContainer>] [-EnableActiveActiveFeature] [-EnableBgp

<Boolean>] [-Force] [-GatewayDefaultSite <PSLocalNetworkGateway>] [-GatewaySku {Basic | Standard | HighPerformance | UltraPerformance | VpnGw1 |

VpnGw2 | VpnGw3}] [-GatewayType {Vpn | ExpressRoute}] [-IpConfigurations

<System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVirtualNetworkGatewayIpConfiguration]>] [-PeerWeight <Int32>] [-Tag

<Hashtable>] [-VpnClientAddressPool <System.Collections.Generic.List`1[System.String]>] [-VpnClientProtocol {SSTP | IkeV2}]

[-VpnClientRevokedCertificates <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRevokedCertificate]>]

[-VpnClientRootCertificates <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRootCertificate]>] [-VpnType

{PolicyBased | RouteBased}] [-Confirm] [-WhatIf] [<CommonParameters>]



New-AzureRmVirtualNetworkGateway [-AsJob] [-Asn <UInt32>] [-DefaultProfile <IAzureContextContainer>] [-EnableActiveActiveFeature] [-EnableBgp

<Boolean>] [-Force] [-GatewaySku {Basic | Standard | HighPerformance | UltraPerformance | VpnGw1 | VpnGw2 | VpnGw3}] [-GatewayType {Vpn |

ExpressRoute}] [-IpConfigurations

<System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVirtualNetworkGatewayIpConfiguration]>] -Location <String> -Name

<String> [-PeerWeight <Int32>] -ResourceGroupName <String> [-Tag <Hashtable>] [-VpnClientAddressPool

<System.Collections.Generic.List`1[System.String]>] [-VpnClientProtocol {SSTP | IkeV2}] [-VpnClientRevokedCertificates

<System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRevokedCertificate]>] [-VpnClientRootCertificates

<System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRootCertificate]>] [-VpnType {PolicyBased | RouteBased}]

[-Confirm] [-WhatIf] [<CommonParameters>]



New-AzureRmVirtualNetworkGateway [-AsJob] [-Asn <UInt32>] [-DefaultProfile <IAzureContextContainer>] [-EnableActiveActiveFeature] [-EnableBgp

<Boolean>] [-Force] [-GatewaySku {Basic | Standard | HighPerformance | UltraPerformance | VpnGw1 | VpnGw2 | VpnGw3}] [-GatewayType {Vpn |

ExpressRoute}] [-IpConfigurations

<System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVirtualNetworkGatewayIpConfiguration]>] -Location <String> -Name

<String> [-PeerWeight <Int32>] -RadiusServerAddress <String> -RadiusServerSecret <SecureString> -ResourceGroupName <String> [-Tag <Hashtable>]

[-VpnClientAddressPool <System.Collections.Generic.List`1[System.String]>] [-VpnClientProtocol {SSTP | IkeV2}] [-VpnClientRevokedCertificates

<System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRevokedCertificate]>] [-VpnClientRootCertificates

<System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRootCertificate]>] [-VpnType {PolicyBased | RouteBased}]

[-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Virtual Network Gateway is the object representing your gateway in Azure.



The New-AzureRmVirtualNetworkGateway cmdlet creates the object of your gateway in Azure based on the Name, Resource Group Name, Location, and IP

configuration, as well as the Gateway Type and if VPN, the VPN Type. You can also name the Gateway SKU.



If this Gateway is being used for Point-to-Site connections, you will also need to include the VPN Client Address Pool from which to assign

addresses to connecting clients and the VPN Client Root Certificate used to authenticate VPN clients connecting to the Gateway.



You can also choose to include other features like BGP and Active-Active.





PARAMETERS

-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Asn <UInt32>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-EnableActiveActiveFeature [<SwitchParameter>]

Enables the active-active feature.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-EnableBgp <Boolean>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Force [<SwitchParameter>]

Forces the command to run without asking for user confirmation.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-GatewayDefaultSite <PSLocalNetworkGateway>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-GatewaySku <String>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-GatewayType <String>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-IpConfigurations <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVirtualNetworkGatewayIpConfiguration]>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Location <String>





Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>





Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-PeerWeight <Int32>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-RadiusServerAddress <String>

P2S External Radius server address.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-RadiusServerSecret <SecureString>

P2S External Radius server secret.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceGroupName <String>





Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Tag <Hashtable>

Key-value pairs in the form of a hash table. For example:



@{key0="value0";key1=$null;key2="value2"}



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VpnClientAddressPool <System.Collections.Generic.List`1[System.String]>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VpnClientProtocol <System.Collections.Generic.List`1[System.String]>

The list of P2S VPN client tunneling protocols



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VpnClientRevokedCertificates <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRevokedCertificate]>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VpnClientRootCertificates <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSVpnClientRootCertificate]>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VpnType <String>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Network.Models.PSVirtualNetworkGateway







NOTES









1: Create a Virtual Network Gateway



New-AzureRmResourceGroup -Location "UK West" -Name "vnet-gateway"

$subnet = New-AzureRMVirtualNetworkSubnetConfig -Name 'gatewaysubnet' -AddressPrefix '10.254.0.0/27'



$ngwpip = New-AzureRMPublicIpAddress -Name ngwpip -ResourceGroupName "vnet-gateway" -Location "UK West" -AllocationMethod Dynamic

$vnet = New-AzureRmVirtualNetwork -AddressPrefix "10.254.0.0/27" -Location "UK West" -Name vnet-gateway -ResourceGroupName "vnet-gateway" -Subnet

$subnet

$subnet = Get-AzureRmVirtualNetworkSubnetConfig -name 'gatewaysubnet' -VirtualNetwork $vnet

$ngwipconfig = New-AzureRMVirtualNetworkGatewayIpConfig -Name ngwipconfig -SubnetId $subnet.Id -PublicIpAddressId $ngwpip.Id



New-AzureRmVirtualNetworkGateway -Name myNGW -ResourceGroupName vnet-gateway -Location "UK West" -IpConfigurations $ngwIpConfig -GatewayType

"Vpn" -VpnType "RouteBased" -GatewaySku "Basic"



The above will create a resource group, request a Public IP Address, create a Virtual Network and subnet and create a Virtual Network Gateway in

Azure.



The gateway will be called "myNGW" within the resource group "vnet-gateway" in the location "UK West" with the previously created IP

configurations saved in the variable "ngwIPConfig," the gateway type of "VPN," the vpn type "RouteBased," and the sku "Basic."





2: Create a Virtual Network Gateway with External Radius Configuration



New-AzureRmResourceGroup -Location "UK West" -Name "vnet-gateway"

New-AzureRMVirtualNetworkSubnetConfig -Name 'gatewaysubnet' -AddressPrefix '10.254.0.0/27'



$ngwpip = New-AzureRMPublicIpAddress -Name ngwpip -ResourceGroupName "vnet-gateway" -Location "UK West" -AllocationMethod Dynamic

$vnet = New-AzureRmVirtualNetwork -AddressPrefix "10.254.0.0/27" -Location "UK West" -Name vnet-gateway -ResourceGroupName "vnet-gateway" -Subnet

$subnet

$subnet = Get-AzureRmVirtualNetworkSubnetConfig -name 'gatewaysubnet' -VirtualNetwork $vnet

$ngwipconfig = New-AzureRMVirtualNetworkGatewayIpConfig -Name ngwipconfig -SubnetId $subnet.Id -PublicIpAddressId $ngwpip.Id

$Secure_String_Pwd = ConvertTo-SecureString "TestRadiusServerPassword" -AsPlainText -Force



New-AzureRmVirtualNetworkGateway -Name myNGW -ResourceGroupName vnet-gateway -Location "UK West" -IpConfigurations $ngwIpConfig -GatewayType

"Vpn" -VpnType "RouteBased" -GatewaySku "Basic" -RadiusServerAddress "TestRadiusServer" -RadiusServerSecret $Secure_String_Pwd



The above will create a resource group, request a Public IP Address, create a Virtual Network and subnet and create a Virtual Network Gateway in

Azure.



The gateway will be called "myNGW" within the resource group "vnet-gateway" in the location "UK West" with the previously created IP

configurations saved in the variable "ngwIPConfig," the gateway type of "VPN," the vpn type "RouteBased," and the sku "Basic." It also adds an

external radius server with address "TestRadiusServer"







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... orkgateway

Get-AzureRmVirtualNetworkGateway

Remove-AzureRmVirtualNetworkGateway

Reset-AzureRmVirtualNetworkGateway

Resize-AzureRmVirtualNetworkGateway

Reset-AzureRmVirtualNetworkGateway