Azure Network Endpoint

This page shows how to write Terraform and Azure Resource Manager for Network Endpoint and write them securely.

azurerm_traffic_manager_endpoint (Terraform)

The Endpoint in Network can be configured in Terraform with the resource name azurerm_traffic_manager_endpoint. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "azurerm_traffic_manager_endpoint" "endpoint" {
  name                = var.name
  resource_group_name = var.resource_group
  profile_name        = var.traffic_manager
  target              = var.target
  type                = var.target_type
az_traffic_manager.tf#L23
resource "azurerm_traffic_manager_endpoint" "scepman_primary_region" {
  name                = "scepman-primary-region"
  resource_group_name = azurerm_resource_group.resource_group.name
  profile_name        = azurerm_traffic_manager_profile.scepman_traffic_manager.name
  type                = "azureEndpoints"
  target_resource_id  = lookup(azurerm_template_deployment.scepman.outputs, "appServiceID")
traffic.tf#L96
resource "azurerm_traffic_manager_endpoint" "cdnendpointbr" {
  name = "trafficbr"
  resource_group_name = azurerm_resource_group.rg.name
  profile_name = azurerm_traffic_manager_profile.trafficprofile.name
  target_resource_id = azurerm_app_service.appservicebr.id
  type = "azureEndpoints"
global-traffic-manager.tf#L26
resource "azurerm_traffic_manager_endpoint" "traffic_manager_main" {
  name                = "traffic_manager_main"
  resource_group_name = azurerm_resource_group.rg1.name
  profile_name        = azurerm_traffic_manager_profile.traffic_manager.name
  target              = "esgi-ben-part3-rg1.westeurope.cloudapp.azure.com"
  type                = "externalEndpoints"

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 Traffic Manager Endpoint.

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/trafficManagerProfiles (Azure Resource Manager)

The trafficManagerProfiles in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/trafficManagerProfiles. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

paasDeploy_v2.json#L97
      "type": "Microsoft.Network/trafficManagerProfiles",
      "name": "[concat(parameters('webAppDnsNamePrefix'),'-tm')]",
      "location": "global",
      "dependsOn": [
        "siteCopy"
      ],
paasDeploy_v2.json#L97
      "type": "Microsoft.Network/trafficManagerProfiles",
      "name": "[concat(parameters('webAppDnsNamePrefix'),'-tm')]",
      "location": "global",
      "dependsOn": [
        "siteCopy"
      ],
contosoPaas.json#L106
      "type": "Microsoft.Network/trafficManagerProfiles",
      "apiVersion": "2015-11-01",
      "location": "global",
      "dependsOn": [
        "siteCopy"
      ],
node-trafficmanager.json#L20
            "type": "Microsoft.Network/trafficManagerProfiles",
            "name": "[parameters('customSettings').trafficManagerName]",
            "apiVersion": "[parameters('apiSettings').trafficManagerApiversion]",
            "location": "global",

            "properties": {
azuredeploy.json#L18
      "type": "Microsoft.Network/trafficManagerProfiles",
      "name": "ExternalEndpointExample",
      "location": "global",
      "properties": {
        "profileStatus": "Enabled",
        "trafficRoutingMethod": "Performance",
azuredeploy.json#L34
      "type": "Microsoft.Network/trafficManagerProfiles",
      "name": "ExternalEndpointExample",
      "location": "global",
      "properties": {
        "profileStatus": "Enabled",
        "trafficRoutingMethod": "Weighted",
azuredeploy.json#L18
      "type": "Microsoft.Network/trafficManagerProfiles",
      "name": "ExternalEndpointExample",
      "location": "global",
      "properties": {
        "profileStatus": "Enabled",
        "trafficRoutingMethod": "Performance",
Resources.TrafficManager.json#L66
        "Type": "Microsoft.Network/trafficManagerProfiles",
        "ResourceType": "Microsoft.Network/trafficManagerProfiles",
        "ExtensionResourceType": null,
        "Sku": null,
        "Tags": {},
        "SubscriptionId": "00000000-0000-0000-0000-000000000000"
azure.com_trafficmanager_2017-05-01.json#L121
                  "type": "Microsoft.Network/trafficManagerProfiles"
                }
              }
            }
          },
          "NameAvailabilityTest_NameNotAvailablePOST23": {
node-trafficmanager.json#L20
            "type": "Microsoft.Network/trafficManagerProfiles",
            "name": "[parameters('customSettings').trafficManagerName]",
            "apiVersion": "[parameters('apiSettings').trafficManagerApiversion]",
            "location": "global",

            "properties": {

Frequently asked questions

What is Azure Network Endpoint?

Azure Network Endpoint 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 Endpoint?

For Terraform, the saiive/saiive.supernode, dipolimene/Template-Samples and higorbarbosa/treinamento-terraform-azure source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the santoshdata/ARMTemp, santoshdata/ARMTemp and santoshdata/ARMTemp source code examples are useful. See the Azure Resource Manager Example section for further details.