Azure Network Profile
This page shows how to write Terraform and Azure Resource Manager for Network Profile and write them securely.
azurerm_network_profile (Terraform)
The Profile in Network can be configured in Terraform with the resource name azurerm_network_profile
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_network_profile" "networkProfile" {
name = "networkProfile"
resource_group_name = azurerm_resource_group.resourceGroup.name
location = azurerm_resource_group.resourceGroup.location
container_network_interface {
name = "containerNetworkInterface"
resource "azurerm_network_profile" "projcore_net_prof" {
name = format("%s-%s", var.projcore_rg_name, "worker-np")
location = var.rg_location
resource_group_name = var.projcore_rg_name
# container_network_interface {
resource "azurerm_network_profile" "this" {
# location - (required) is a type of string
location = var.location
# name - (required) is a type of string
name = var.name
# resource_group_name - (required) is a type of string
resource "azurerm_network_profile" "this" {
location = var.location
name = var.name
resource_group_name = var.resource_group_name
tags = var.tags
resource "azurerm_network_profile" "grafana" {
name = "grafana-net-profile"
location = azurerm_resource_group.resourcegroup.location
resource_group_name = azurerm_resource_group.resourcegroup.name
container_network_interface {
resource "azurerm_network_profile" "netop-np" {
name = var.name
location = var.location
resource_group_name = var.resource-group
container_network_interface {
resource "azurerm_network_profile" "network-profile" {
name = var.network_profile_name
location = azurerm_resource_group.resource-group.location
resource_group_name = azurerm_resource_group.resource-group.name
depends_on = [azurerm_resource_group.resource-group]
resource "azurerm_network_profile" "network_profile" {
count = var.vnet_integration_enabled ? 1 : 0
name = coalesce(var.network_profile_custom_name, local.default_network_profile_name)
location = var.location
resource_group_name = var.resource_group_name
resource "azurerm_network_profile" "example" {
name = "examplenetprofile"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
container_network_interface {
resource "azurerm_network_profile" "this" {
location = var.location
name = var.name
resource_group_name = var.resource_group_name
tags = var.tags
Parameters
-
container_network_interface_ids
optional computed - list of string -
id
optional computed - string -
location
required - string -
name
required - string -
resource_group_name
required - string -
tags
optional - map from string to string -
container_network_interface
list block-
name
required - string -
ip_configuration
list block
-
-
timeouts
single block
Explanation in Terraform Registry
Manages a Network Profile.
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/networkProfiles (Azure Resource Manager)
The networkProfiles in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/networkProfiles
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile2",
"name": "networkProfile2",
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile2",
"name": "networkProfile2",
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile2",
"name": "networkProfile2",
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile2",
"name": "networkProfile2",
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap",
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "1570d8b6-ab8a-4ad2-81d6-d2799b429cbf",
"containerNetworkInterfaceConfigurations": [
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap",
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "1570d8b6-ab8a-4ad2-81d6-d2799b429cbf",
"containerNetworkInterfaceConfigurations": [
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap",
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "1570d8b6-ab8a-4ad2-81d6-d2799b429cbf",
"containerNetworkInterfaceConfigurations": [
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap",
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "1570d8b6-ab8a-4ad2-81d6-d2799b429cbf",
"containerNetworkInterfaceConfigurations": [
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile2",
"name": "networkProfile2",
"type": "Microsoft.Network/networkProfiles",
"location": "centraluseuap"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkProfiles/networkProfile2",
"name": "networkProfile2",
Parameters
name
required - stringtype
required - stringapiVersion
required - stringlocation
required - stringResource location.
tags
optional - stringResource tags.
properties
requiredcontainerNetworkInterfaceConfigurations
optional arrayproperties
optionalipConfigurations
optional arrayproperties
optionalsubnet
optionalid
required - stringResource ID.
name
optional - stringThe name of the resource. This name can be used to access the resource.
containerNetworkInterfaces
optional arrayid
required - stringResource ID.
name
optional - stringThe name of the resource. This name can be used to access the resource.
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 jordanbean-msft/app-service-perf, DFE-Digital/claim-additional-payments-for-teaching-qts-api and huw564/k8s source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the assing/alerts-extension, assing/alerts-extension and assing/alerts-extension source code examples are useful. See the Azure Resource Manager Example section for further details.