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

point_to_site_gateway.tf#L41
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
point_to_site_gateway.tf#L53
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
point_to_site_gateway.tf#L53
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
point_to_site_gateway.tf#L53
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
point_to_site_gateway.tf#L41
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
point_to_site_gateway.tf#L53
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
main.tf#L7
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
point_to_site_gateway.tf#L41
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
main.tf#L7
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
point_to_site_gateway.tf#L53
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

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

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.

risk-label

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.

risk-label

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.

risk-label

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.

Review your Azure Network settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

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

virtual-wan.deploy.json#L113
      "type": "Microsoft.Network/vpnServerConfigurations",
      "copy": {
        "name": "p2sGatewayConfigs",
        "count": "[length(parameters('hubs'))]"
      },
      "condition": "[parameters('hubs')[copyIndex()].p2sGateway.shouldExist]",
updateenv.json#L84
            "type": "Microsoft.Network/vpnServerConfigurations",
            "apiVersion": "2020-05-01",
            "name": "[format('{0}_P2SvpnServerConfiguration', variables('virtual_hub_cfg').name)]",
            "location": "[parameters('Hub_Location')]",
            "dependsOn": [
            ],
azuredeploy.json#L390
            "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))]"
VpnServerConfigurationListByResourceGroup.json#L16
            "type": "Microsoft.Network/vpnServerConfigurations",
            "tags": {
              "key1": "value1"
            },
            "properties": {
              "provisioningState": "Succeeded",
VpnServerConfigurationList.json#L15
            "type": "Microsoft.Network/vpnServerConfigurations",
            "tags": {
              "key1": "value1"
            },
            "properties": {
              "provisioningState": "Succeeded",
VpnServerConfigurationList.json#L15
            "type": "Microsoft.Network/vpnServerConfigurations",
            "tags": {
              "key1": "value1"
            },
            "properties": {
              "provisioningState": "Succeeded",
VpnServerConfigurationListByResourceGroup.json#L16
            "type": "Microsoft.Network/vpnServerConfigurations",
            "tags": {
              "key1": "value1"
            },
            "properties": {
              "provisioningState": "Succeeded",
VpnServerConfigurationList.json#L15
            "type": "Microsoft.Network/vpnServerConfigurations",
            "tags": {
              "key1": "value1"
            },
            "properties": {
              "provisioningState": "Succeeded",
VpnServerConfigurationListByResourceGroup.json#L16
            "type": "Microsoft.Network/vpnServerConfigurations",
            "tags": {
              "key1": "value1"
            },
            "properties": {
              "provisioningState": "Succeeded",
VpnServerConfigurationListByResourceGroup.json#L16
            "type": "Microsoft.Network/vpnServerConfigurations",
            "tags": {
              "key1": "value1"
            },
            "properties": {
              "provisioningState": "Succeeded",

Parameters

  • name required - string
  • type required - string
  • apiVersion required - string
  • location required - string

    Resource location.

  • tags optional - string

    Resource tags.

  • properties required
      • name optional - string

        The name of the VpnServerConfiguration that is unique within a resource group.

      • vpnProtocols optional - array

        VPN protocols for the VpnServerConfiguration.

      • vpnAuthenticationTypes optional - array

        VPN authentication types for the VpnServerConfiguration.

      • vpnClientRootCertificates optional array
          • name optional - string

            The certificate name.

          • publicCertData optional - string

            The certificate public data.

      • vpnClientRevokedCertificates optional array
          • name optional - string

            The certificate name.

          • thumbprint optional - string

            The revoked VPN client certificate thumbprint.

      • radiusServerRootCertificates optional array
          • name optional - string

            The certificate name.

          • publicCertData optional - string

            The certificate public data.

      • radiusClientRootCertificates optional array
          • name optional - string

            The certificate name.

          • thumbprint optional - string

            The Radius client root certificate thumbprint.

      • vpnClientIpsecPolicies optional array
          • saLifeTimeSeconds required - integer

            The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN tunnel.

          • saDataSizeKilobytes required - integer

            The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN tunnel.

          • ipsecEncryption required - string

            The IPSec encryption algorithm (IKE phase 1).

          • ipsecIntegrity required - string

            The IPSec integrity algorithm (IKE phase 1).

          • ikeEncryption required - string

            The IKE encryption algorithm (IKE phase 2).

          • ikeIntegrity required - string

            The IKE integrity algorithm (IKE phase 2).

          • dhGroup required - string

            The DH Group used in IKE Phase 1 for initial SA.

          • pfsGroup required - string

            The Pfs Group used in IKE Phase 2 for new child SA.

      • radiusServerAddress optional - string

        The radius server address property of the VpnServerConfiguration resource for point to site client connection.

      • radiusServerSecret optional - string

        The radius secret property of the VpnServerConfiguration resource for point to site client connection.

      • radiusServers optional array
          • radiusServerAddress required - string

            The address of this radius server.

          • radiusServerScore optional - integer

            The initial score assigned to this radius server.

          • radiusServerSecret optional - string

            The secret used for this radius server.

      • aadAuthenticationParameters optional
          • aadTenant optional - string

            AAD Vpn authentication parameter AAD tenant.

          • aadAudience optional - string

            AAD Vpn authentication parameter AAD audience.

          • aadIssuer optional - string

            AAD 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.