Azure Network Profile

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

azurerm_traffic_manager_profile (Terraform)

The Profile in Network can be configured in Terraform with the resource name azurerm_traffic_manager_profile. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L10
resource "azurerm_traffic_manager_profile" "profile" {
  name                   = var.profile_name
  resource_group_name    = var.resource_group_name
  traffic_routing_method = "Priority"

  dns_config {
atm.tf#L19
resource "azurerm_traffic_manager_profile" "example" {
  name                = random_id.server.hex
  resource_group_name = azurerm_resource_group.example.name

  traffic_routing_method = "Weighted"

main.tf#L5
resource "azurerm_traffic_manager_profile" "tmp" {
  name                = var.tmp_name
  resource_group_name = var.rg_name

  traffic_routing_method = var.tmp_rtn

main.tf#L6
resource "azurerm_traffic_manager_profile" "profile" {
  name                   = var.traffic_manager_profile_name
  resource_group_name    = data.azurerm_resource_group.tmrg.name
  traffic_routing_method = "Weighted"

  dns_config {
main.tf#L18
resource "azurerm_traffic_manager_profile" "example" {
  name                = random_id.server.hex
  resource_group_name = azurerm_resource_group.example.name

  traffic_routing_method = "Weighted"

az_traffic_manager.tf#L2
resource "azurerm_traffic_manager_profile" "scepman_traffic_manager" {
  name                   = "tm-emtwenty"
  resource_group_name = azurerm_resource_group.resource_group.name
  traffic_routing_method = "Performance"
  depends_on = [azurerm_template_deployment.scepman, azurerm_template_deployment.scepman_clone_app]

main.tf#L28
resource "azurerm_traffic_manager_profile" "traffic_manager_profile" {
  name                   = format("%s-trafficmgr-%s", var.base_name, var.service_name)
  resource_group_name    = var.resource_group_name
  traffic_routing_method = var.traffic_routing_method

  dns_config {
trafficmanager.tf#L1
resource "azurerm_traffic_manager_profile" "traffic_manager_profile" {
  name                = format("traf-%s-%s", var.environment,var.application_name)
  resource_group_name = azurerm_resource_group.rg_subscription_bzunit_env_region["pri"].name

  traffic_routing_method = "Priority"

traffic-manager.tf#L1
resource "azurerm_traffic_manager_profile" "mobileApp" {
  name                = "azurermTrafficManagerProfileGaming4Life"
  resource_group_name = var.resource_group_name
  traffic_routing_method = "Weighted"

  dns_config {
Main.tf#L2
resource "azurerm_traffic_manager_profile" "main" {
  name                   = var.profile_name
  resource_group_name    = var.resource_group_name
  traffic_routing_method = var.traffic_routing_method
  max_return             = var.max_return

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 Profile to which multiple endpoints can be attached.

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 Profile?

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

For Terraform, the javaadpatel/terraform-for-high-availability, farrukh90/azure-terraform and MohammadBnei/terraform-esgi 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.