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
resource "azurerm_traffic_manager_profile" "profile" {
name = var.profile_name
resource_group_name = var.resource_group_name
traffic_routing_method = "Priority"
dns_config {
resource "azurerm_traffic_manager_profile" "example" {
name = random_id.server.hex
resource_group_name = azurerm_resource_group.example.name
traffic_routing_method = "Weighted"
resource "azurerm_traffic_manager_profile" "tmp" {
name = var.tmp_name
resource_group_name = var.rg_name
traffic_routing_method = var.tmp_rtn
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 {
resource "azurerm_traffic_manager_profile" "example" {
name = random_id.server.hex
resource_group_name = azurerm_resource_group.example.name
traffic_routing_method = "Weighted"
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]
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 {
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"
resource "azurerm_traffic_manager_profile" "mobileApp" {
name = "azurermTrafficManagerProfileGaming4Life"
resource_group_name = var.resource_group_name
traffic_routing_method = "Weighted"
dns_config {
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
Parameters
-
fqdn
optional computed - string -
id
optional computed - string -
max_return
optional - number -
name
required - string -
profile_status
optional computed - string -
resource_group_name
required - string -
tags
optional - map from string to string -
traffic_routing_method
required - string -
traffic_view_enabled
optional - bool -
dns_config
list block-
relative_name
required - string -
ttl
required - number
-
-
monitor_config
list block-
expected_status_code_ranges
optional - list of string -
interval_in_seconds
optional - number -
path
optional - string -
port
required - number -
protocol
required - string -
timeout_in_seconds
optional - number -
tolerated_number_of_failures
optional - number -
custom_header
list block
-
-
timeouts
single block
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.
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/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
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[concat(parameters('webAppDnsNamePrefix'),'-tm')]",
"location": "global",
"dependsOn": [
"siteCopy"
],
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[concat(parameters('webAppDnsNamePrefix'),'-tm')]",
"location": "global",
"dependsOn": [
"siteCopy"
],
"type": "Microsoft.Network/trafficManagerProfiles",
"apiVersion": "2015-11-01",
"location": "global",
"dependsOn": [
"siteCopy"
],
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[parameters('customSettings').trafficManagerName]",
"apiVersion": "[parameters('apiSettings').trafficManagerApiversion]",
"location": "global",
"properties": {
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "ExternalEndpointExample",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "ExternalEndpointExample",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Weighted",
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "ExternalEndpointExample",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"Type": "Microsoft.Network/trafficManagerProfiles",
"ResourceType": "Microsoft.Network/trafficManagerProfiles",
"ExtensionResourceType": null,
"Sku": null,
"Tags": {},
"SubscriptionId": "00000000-0000-0000-0000-000000000000"
"type": "Microsoft.Network/trafficManagerProfiles"
}
}
}
},
"NameAvailabilityTest_NameNotAvailablePOST23": {
"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.