Azure Network Connection Monitor
This page shows how to write Terraform and Azure Resource Manager for Network Connection Monitor and write them securely.
azurerm_network_connection_monitor (Terraform)
The Connection Monitor in Network can be configured in Terraform with the resource name azurerm_network_connection_monitor. The following sections describe 2 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_network_connection_monitor" "this" {
auto_start = var.auto_start
interval_in_seconds = var.interval_in_seconds
location = var.location
name = var.name
network_watcher_name = var.network_watcher_name
resource "azurerm_network_connection_monitor" "this" {
auto_start = var.auto_start
interval_in_seconds = var.interval_in_seconds
location = var.location
name = var.name
network_watcher_name = var.network_watcher_name
Parameters
-
auto_startoptional computed - bool -
idoptional computed - string -
interval_in_secondsoptional computed - number -
locationrequired - string -
namerequired - string -
network_watcher_idrequired - string -
notesoptional - string -
output_workspace_resource_idsoptional computed - set of string -
tagsoptional - map from string to string -
destinationlist block-
addressoptional computed - string -
portoptional computed - number -
virtual_machine_idoptional computed - string
-
-
endpointset block -
sourcelist block-
portoptional computed - number -
virtual_machine_idoptional computed - string
-
-
test_configurationset block-
namerequired - string -
preferred_ip_versionoptional - string -
protocolrequired - string -
test_frequency_in_secondsoptional - number -
http_configurationlist block-
methodoptional - string -
pathoptional - string -
portoptional - number -
prefer_httpsoptional - bool -
valid_status_code_rangesoptional - set of string -
request_headerset block
-
-
icmp_configurationlist block-
trace_route_enabledoptional - bool
-
-
success_thresholdlist block-
checks_failed_percentoptional - number -
round_trip_time_msoptional - number
-
-
tcp_configurationlist block-
portrequired - number -
trace_route_enabledoptional - bool
-
-
-
test_groupset block-
destination_endpointsrequired - set of string -
enabledoptional - bool -
namerequired - string -
source_endpointsrequired - set of string -
test_configuration_namesrequired - set of string
-
-
timeoutssingle block
Explanation in Terraform Registry
Manages a Network Connection Monitor.
NOTE: Any Network Connection Monitor resource created with API versions 2019-06-01 or earlier (v1) are now incompatible with Terraform, which now only supports v2.
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/networkWatchers/connectionMonitors (Azure Resource Manager)
The networkWatchers/connectionMonitors in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/networkWatchers/connectionMonitors. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
namerequired - stringtyperequired - stringapiVersionrequired - stringlocationoptional - stringConnection monitor location.
tagsoptional - stringConnection monitor tags.
propertiesrequiredsourceoptionalresourceIdrequired - stringThe ID of the resource used as the source by connection monitor.
portoptional - integerThe source port used by connection monitor.
destinationoptionalresourceIdoptional - stringThe ID of the resource used as the destination by connection monitor.
addressoptional - stringAddress of the connection monitor destination (IP or domain name).
portoptional - integerThe destination port used by connection monitor.
autoStartoptional - booleanDetermines if the connection monitor will start automatically once created.
monitoringIntervalInSecondsoptional - integerMonitoring interval in seconds.
endpointsoptional arraynamerequired - stringThe name of the connection monitor endpoint.
typeoptional - stringThe endpoint type.
resourceIdoptional - stringResource ID of the connection monitor endpoint.
addressoptional - stringAddress of the connection monitor endpoint (IP or domain name).
filteroptionaltypeoptional - stringThe behavior of the endpoint filter. Currently only 'Include' is supported.
itemsoptional arraytypeoptional - stringThe type of item included in the filter. Currently only 'AgentAddress' is supported.
addressoptional - stringThe address of the filter item.
scopeoptionalincludeoptional arrayaddressoptional - stringThe address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or IPv4/IPv6 IP address.
excludeoptional arrayaddressoptional - stringThe address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or IPv4/IPv6 IP address.
coverageLeveloptional - stringTest coverage for the endpoint.
testConfigurationsoptional arraynamerequired - stringThe name of the connection monitor test configuration.
testFrequencySecoptional - integerThe frequency of test evaluation, in seconds.
protocolrequired - stringThe protocol to use in test evaluation.
preferredIPVersionoptional - stringThe preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters.
httpConfigurationoptionalportoptional - integerThe port to connect to.
methodoptional - stringThe HTTP method to use.
pathoptional - stringThe path component of the URI. For instance, "/dir1/dir2".
requestHeadersoptional arraynameoptional - stringThe name in HTTP header.
valueoptional - stringThe value in HTTP header.
validStatusCodeRangesoptional - arrayHTTP status codes to consider successful. For instance, "2xx,301-304,418".
preferHTTPSoptional - booleanValue indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit.
tcpConfigurationoptionalportoptional - integerThe port to connect to.
disableTraceRouteoptional - booleanValue indicating whether path evaluation with trace route should be disabled.
destinationPortBehavioroptional - stringDestination port behavior.
icmpConfigurationoptionaldisableTraceRouteoptional - booleanValue indicating whether path evaluation with trace route should be disabled.
successThresholdoptionalchecksFailedPercentoptional - integerThe maximum percentage of failed checks permitted for a test to evaluate as successful.
roundTripTimeMsoptional - numberThe maximum round-trip time in milliseconds permitted for a test to evaluate as successful.
testGroupsoptional arraynamerequired - stringThe name of the connection monitor test group.
disableoptional - booleanValue indicating whether test group is disabled.
testConfigurationsrequired - arrayList of test configuration names.
sourcesrequired - arrayList of source endpoint names.
destinationsrequired - arrayList of destination endpoint names.
outputsoptional arraytypeoptional - stringConnection monitor output destination type. Currently, only "Workspace" is supported.
workspaceSettingsoptionalworkspaceResourceIdoptional - stringLog analytics workspace resource ID.
notesoptional - stringOptional notes to be associated with the connection monitor.
Frequently asked questions
What is Azure Network Connection Monitor?
Azure Network Connection Monitor 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 Connection Monitor?
For Terraform, the kevinhead/azurerm and niveklabs/azurerm source code examples are useful. See the Terraform Example section for further details.