Azure Network Server Configuration
This page shows how to write Terraform and Azure Resource Manager for Network Server Configuration and write them securely.
azurerm_vpn_server_configuration (Terraform)
The Server Configuration in Network can be configured in Terraform with the resource name azurerm_vpn_server_configuration. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = var.virtual_hub_config.deploy_p2s ? 1 : 0
name = azurecaf_naming_convention.p2s_gateway.0.result
resource_group_name = var.resource_group_name
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = try(var.virtual_hub_config.deploy_p2s, false) ? 1 : 0
name = azurecaf_name.p2s_gateway.0.result
resource_group_name = var.resource_group_name
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = var.virtual_hub_config.deploy_p2s ? 1 : 0
name = azurecaf_name.p2s_gateway.0.result
resource_group_name = var.resource_group_name
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = try(var.virtual_hub_config.deploy_p2s, false) ? 1 : 0
name = azurecaf_name.p2s_gateway.0.result
resource_group_name = var.resource_group_name
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = var.virtual_hub_config.deploy_p2s ? 1 : 0
name = azurecaf_naming_convention.p2s_gateway.0.result
resource_group_name = var.resource_group_name
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = try(var.virtual_hub_config.deploy_p2s, false) ? 1 : 0
name = azurecaf_name.p2s_gateway.0.result
resource_group_name = var.resource_group_name
resource "azurerm_vpn_server_configuration" "this" {
location = var.location
name = var.name
resource_group_name = var.resource_group_name
tags = var.tags
vpn_authentication_types = var.vpn_authentication_types
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = var.virtual_hub_config.deploy_p2s ? 1 : 0
name = azurecaf_naming_convention.p2s_gateway.0.result
resource_group_name = var.resource_group_name
resource "azurerm_vpn_server_configuration" "this" {
location = var.location
name = var.name
resource_group_name = var.resource_group_name
tags = var.tags
vpn_authentication_types = var.vpn_authentication_types
resource "azurerm_vpn_server_configuration" "p2s_configuration" {
depends_on = [azurerm_virtual_hub.vwan_hub]
count = try(var.virtual_hub_config.deploy_p2s, false) ? 1 : 0
name = azurecaf_name.p2s_gateway.0.result
resource_group_name = var.resource_group_name
Parameters
-
idoptional computed - string -
locationrequired - string -
namerequired - string -
resource_group_namerequired - string -
tagsoptional - map from string to string -
vpn_authentication_typesrequired - list of string -
vpn_protocolsoptional computed - set of string -
azure_active_directory_authenticationlist block -
client_revoked_certificateset block-
namerequired - string -
thumbprintrequired - string
-
-
client_root_certificateset block-
namerequired - string -
public_cert_datarequired - string
-
-
ipsec_policylist block-
dh_grouprequired - string -
ike_encryptionrequired - string -
ike_integrityrequired - string -
ipsec_encryptionrequired - string -
ipsec_integrityrequired - string -
pfs_grouprequired - string -
sa_data_size_kilobytesrequired - number -
sa_lifetime_secondsrequired - number
-
-
radiuslist block-
client_root_certificateset block-
namerequired - string -
thumbprintrequired - string
-
-
serverlist block -
server_root_certificateset block-
namerequired - string -
public_cert_datarequired - string
-
-
-
radius_serverlist block-
addressrequired - string -
secretrequired - string -
client_root_certificateset block-
namerequired - string -
thumbprintrequired - string
-
-
server_root_certificateset block-
namerequired - string -
public_cert_datarequired - string
-
-
-
timeoutssingle block
Explanation in Terraform Registry
Manages a VPN Server Configuration.
Tips: Best Practices for The Other Azure Network Resources
In addition to the azurerm_network_security_group, Azure Network has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_network_security_group
Ensure to disable RDP port from the Internet
It is better to disable the RDP port from the Internet. RDP access should not be accepted from the Internet (*, 0.0.0.0, /0, internet, any), and consider using the Azure Bastion Service.
azurerm_network_security_rule
Ensure to set a more restrictive CIDR range for ingress from the internet
It is better to set a more restrictive CIDR range not to use very broad subnets. If possible, segments should be divided into smaller subnets.
azurerm_network_watcher_flow_log
Ensure to enable Retention policy for flow logs and set it to enough duration
It is better to enable a retention policy for flow logs. Flow logs show us all network activity in the cloud environment and support us when we face critical incidents.
Microsoft.Network/vpnServerConfigurations (Azure Resource Manager)
The vpnServerConfigurations in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/vpnServerConfigurations. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Network/vpnServerConfigurations",
"copy": {
"name": "p2sGatewayConfigs",
"count": "[length(parameters('hubs'))]"
},
"condition": "[parameters('hubs')[copyIndex()].p2sGateway.shouldExist]",
"type": "Microsoft.Network/vpnServerConfigurations",
"apiVersion": "2020-05-01",
"name": "[format('{0}_P2SvpnServerConfiguration', variables('virtual_hub_cfg').name)]",
"location": "[parameters('Hub_Location')]",
"dependsOn": [
],
"type": "Microsoft.Network/vpnServerConfigurations",
"apiVersion": "2020-05-01",
"name": "[format('{0}_P2SvpnServerConfiguration', variables('virtual_hub1_cfg').name)]",
"location": "[parameters('hub1_location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/expressRouteGateways', format('{0}_ERGW', variables('virtual_hub1_cfg').name))]"
"type": "Microsoft.Network/vpnServerConfigurations",
"tags": {
"key1": "value1"
},
"properties": {
"provisioningState": "Succeeded",
"type": "Microsoft.Network/vpnServerConfigurations",
"tags": {
"key1": "value1"
},
"properties": {
"provisioningState": "Succeeded",
"type": "Microsoft.Network/vpnServerConfigurations",
"tags": {
"key1": "value1"
},
"properties": {
"provisioningState": "Succeeded",
"type": "Microsoft.Network/vpnServerConfigurations",
"tags": {
"key1": "value1"
},
"properties": {
"provisioningState": "Succeeded",
"type": "Microsoft.Network/vpnServerConfigurations",
"tags": {
"key1": "value1"
},
"properties": {
"provisioningState": "Succeeded",
"type": "Microsoft.Network/vpnServerConfigurations",
"tags": {
"key1": "value1"
},
"properties": {
"provisioningState": "Succeeded",
"type": "Microsoft.Network/vpnServerConfigurations",
"tags": {
"key1": "value1"
},
"properties": {
"provisioningState": "Succeeded",
Parameters
namerequired - stringtyperequired - stringapiVersionrequired - stringlocationrequired - stringResource location.
tagsoptional - stringResource tags.
propertiesrequirednameoptional - stringThe name of the VpnServerConfiguration that is unique within a resource group.
vpnProtocolsoptional - arrayVPN protocols for the VpnServerConfiguration.
vpnAuthenticationTypesoptional - arrayVPN authentication types for the VpnServerConfiguration.
vpnClientRootCertificatesoptional arraynameoptional - stringThe certificate name.
publicCertDataoptional - stringThe certificate public data.
vpnClientRevokedCertificatesoptional arraynameoptional - stringThe certificate name.
thumbprintoptional - stringThe revoked VPN client certificate thumbprint.
radiusServerRootCertificatesoptional arraynameoptional - stringThe certificate name.
publicCertDataoptional - stringThe certificate public data.
radiusClientRootCertificatesoptional arraynameoptional - stringThe certificate name.
thumbprintoptional - stringThe Radius client root certificate thumbprint.
vpnClientIpsecPoliciesoptional arraysaLifeTimeSecondsrequired - integerThe IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN tunnel.
saDataSizeKilobytesrequired - integerThe IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN tunnel.
ipsecEncryptionrequired - stringThe IPSec encryption algorithm (IKE phase 1).
ipsecIntegrityrequired - stringThe IPSec integrity algorithm (IKE phase 1).
ikeEncryptionrequired - stringThe IKE encryption algorithm (IKE phase 2).
ikeIntegrityrequired - stringThe IKE integrity algorithm (IKE phase 2).
dhGrouprequired - stringThe DH Group used in IKE Phase 1 for initial SA.
pfsGrouprequired - stringThe Pfs Group used in IKE Phase 2 for new child SA.
radiusServerAddressoptional - stringThe radius server address property of the VpnServerConfiguration resource for point to site client connection.
radiusServerSecretoptional - stringThe radius secret property of the VpnServerConfiguration resource for point to site client connection.
radiusServersoptional arrayradiusServerAddressrequired - stringThe address of this radius server.
radiusServerScoreoptional - integerThe initial score assigned to this radius server.
radiusServerSecretoptional - stringThe secret used for this radius server.
aadAuthenticationParametersoptionalaadTenantoptional - stringAAD Vpn authentication parameter AAD tenant.
aadAudienceoptional - stringAAD Vpn authentication parameter AAD audience.
aadIssueroptional - stringAAD Vpn authentication parameter AAD issuer.
Frequently asked questions
What is Azure Network Server Configuration?
Azure Network Server Configuration is a resource for Network of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Network Server Configuration?
For Terraform, the tushar7653/testcaf, anmoltoppo/Terraform and davesee/terraform-caf-rover-breakout source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the tmeadon/clippings, Lagler-Gruener/AzureTemplates and kloudexpedition/azure-quickstart-templates source code examples are useful. See the Azure Resource Manager Example section for further details.