From 8375adc964cf6fbcd54b31bbfcb5292e94f06b9c Mon Sep 17 00:00:00 2001 From: milescattini Date: Sat, 27 Aug 2022 22:20:06 +1000 Subject: [PATCH 1/8] test auto name assign - create ipconf without name --- .../networkInterfaces/.test/parameters.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/Microsoft.Network/networkInterfaces/.test/parameters.json b/modules/Microsoft.Network/networkInterfaces/.test/parameters.json index f281b07b14..561ab465c5 100644 --- a/modules/Microsoft.Network/networkInterfaces/.test/parameters.json +++ b/modules/Microsoft.Network/networkInterfaces/.test/parameters.json @@ -33,6 +33,20 @@ "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<>-az-asg-x-001" } ] + }, + { + "name": null, + "subnetResourceId": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001", + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/loadBalancers/adp-<>-az-lb-internal-001/backendAddressPools/servers" + } + ], + "applicationSecurityGroups": [ + { + "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<>-az-asg-x-001" + } + ] } ] }, From 918706d1c36a7ab2d29bd6cb5803e83e36a13be2 Mon Sep 17 00:00:00 2001 From: milescattini Date: Sat, 27 Aug 2022 22:26:57 +1000 Subject: [PATCH 2/8] Update Readme to match PR --- .../networkInterfaces/readme.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/Microsoft.Network/networkInterfaces/readme.md b/modules/Microsoft.Network/networkInterfaces/readme.md index 9c6e6d58ab..1d26ab762a 100644 --- a/modules/Microsoft.Network/networkInterfaces/readme.md +++ b/modules/Microsoft.Network/networkInterfaces/readme.md @@ -267,6 +267,20 @@ module networkInterfaces './Microsoft.Network/networkInterfaces/deploy.bicep' = name: 'ipconfig01' subnetResourceId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001' } + { + applicationSecurityGroups: [ + { + id: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<>-az-asg-x-001' + } + ] + loadBalancerBackendAddressPools: [ + { + id: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/loadBalancers/adp-<>-az-lb-internal-001/backendAddressPools/servers' + } + ] + name: null + subnetResourceId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001' + } ] name: '<>-az-nic-x-001' // Non-required parameters @@ -316,6 +330,20 @@ module networkInterfaces './Microsoft.Network/networkInterfaces/deploy.bicep' = ], "name": "ipconfig01", "subnetResourceId": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001" + }, + { + "applicationSecurityGroups": [ + { + "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<>-az-asg-x-001" + } + ], + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/loadBalancers/adp-<>-az-lb-internal-001/backendAddressPools/servers" + } + ], + "name": null, + "subnetResourceId": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001" } ] }, From 6cff3726e0525d456d6db4537d7fc37f0dfc99f1 Mon Sep 17 00:00:00 2001 From: milescattini Date: Sat, 27 Aug 2022 22:59:36 +1000 Subject: [PATCH 3/8] handle null ipconfiguration name --- modules/Microsoft.Network/networkInterfaces/deploy.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/networkInterfaces/deploy.bicep b/modules/Microsoft.Network/networkInterfaces/deploy.bicep index ab16b53571..a324366739 100644 --- a/modules/Microsoft.Network/networkInterfaces/deploy.bicep +++ b/modules/Microsoft.Network/networkInterfaces/deploy.bicep @@ -100,7 +100,7 @@ resource networkInterface 'Microsoft.Network/networkInterfaces@2021-08-01' = { id: networkSecurityGroupResourceId } : null ipConfigurations: [for (ipConfiguration, index) in ipConfigurations: { - name: !empty(ipConfiguration.name) ? ipConfiguration.name : null + name: !empty(ipConfiguration.name) ? ipConfiguration.name : 'ipconfig-${index}' properties: { primary: index == 0 ? true : false privateIPAllocationMethod: contains(ipConfiguration, 'privateIPAllocationMethod') ? (!empty(ipConfiguration.privateIPAllocationMethod) ? ipConfiguration.privateIPAllocationMethod : null) : null From 4e81a99843ff2c804bb9670abc684c33dfc3b4b9 Mon Sep 17 00:00:00 2001 From: milescattini Date: Sat, 27 Aug 2022 23:03:03 +1000 Subject: [PATCH 4/8] update readme tables --- .../networkInterfaces/readme.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/Microsoft.Network/networkInterfaces/readme.md b/modules/Microsoft.Network/networkInterfaces/readme.md index 1d26ab762a..821385bdb0 100644 --- a/modules/Microsoft.Network/networkInterfaces/readme.md +++ b/modules/Microsoft.Network/networkInterfaces/readme.md @@ -4,11 +4,16 @@ This module deploys Network Interfaces. ## Navigation -- [Resource Types](#Resource-Types) -- [Parameters](#Parameters) -- [Outputs](#Outputs) -- [Cross-referenced modules](#Cross-referenced-modules) -- [Deployment examples](#Deployment-examples) +- [Network Interface `[Microsoft.Network/networkInterfaces]`](#network-interface-microsoftnetworknetworkinterfaces) + - [Navigation](#navigation) + - [Resource Types](#resource-types) + - [Parameters](#parameters) + - [Parameter Usage: `ipConfigurations`](#parameter-usage-ipconfigurations) + - [Parameter Usage: `roleAssignments`](#parameter-usage-roleassignments) + - [Parameter Usage: `tags`](#parameter-usage-tags) + - [Outputs](#outputs) + - [Cross-referenced modules](#cross-referenced-modules) + - [Deployment examples](#deployment-examples) ## Resource Types @@ -47,7 +52,6 @@ This module deploys Network Interfaces. | `roleAssignments` | array | `[]` | | Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalId' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11'. | | `tags` | object | `{object}` | | Tags of the resource. | - ### Parameter Usage: `ipConfigurations` The IP configurations to apply to the network interface. From 6f940fe99be4e01b34aad6c76ebf502476f479d0 Mon Sep 17 00:00:00 2001 From: milescattini Date: Sat, 27 Aug 2022 23:19:20 +1000 Subject: [PATCH 5/8] re-generate readme --- .../networkInterfaces/readme.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/Microsoft.Network/networkInterfaces/readme.md b/modules/Microsoft.Network/networkInterfaces/readme.md index 821385bdb0..1d26ab762a 100644 --- a/modules/Microsoft.Network/networkInterfaces/readme.md +++ b/modules/Microsoft.Network/networkInterfaces/readme.md @@ -4,16 +4,11 @@ This module deploys Network Interfaces. ## Navigation -- [Network Interface `[Microsoft.Network/networkInterfaces]`](#network-interface-microsoftnetworknetworkinterfaces) - - [Navigation](#navigation) - - [Resource Types](#resource-types) - - [Parameters](#parameters) - - [Parameter Usage: `ipConfigurations`](#parameter-usage-ipconfigurations) - - [Parameter Usage: `roleAssignments`](#parameter-usage-roleassignments) - - [Parameter Usage: `tags`](#parameter-usage-tags) - - [Outputs](#outputs) - - [Cross-referenced modules](#cross-referenced-modules) - - [Deployment examples](#deployment-examples) +- [Resource Types](#Resource-Types) +- [Parameters](#Parameters) +- [Outputs](#Outputs) +- [Cross-referenced modules](#Cross-referenced-modules) +- [Deployment examples](#Deployment-examples) ## Resource Types @@ -52,6 +47,7 @@ This module deploys Network Interfaces. | `roleAssignments` | array | `[]` | | Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalId' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11'. | | `tags` | object | `{object}` | | Tags of the resource. | + ### Parameter Usage: `ipConfigurations` The IP configurations to apply to the network interface. From 31ad8a8be66ebc6e4a64df87f2429c3ad798e4fe Mon Sep 17 00:00:00 2001 From: milescattini Date: Sun, 28 Aug 2022 18:34:44 +1000 Subject: [PATCH 6/8] remove unneeded load balancer and name for ipconf --- .../networkInterfaces/.test/parameters.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/Microsoft.Network/networkInterfaces/.test/parameters.json b/modules/Microsoft.Network/networkInterfaces/.test/parameters.json index 561ab465c5..9b22bf25de 100644 --- a/modules/Microsoft.Network/networkInterfaces/.test/parameters.json +++ b/modules/Microsoft.Network/networkInterfaces/.test/parameters.json @@ -35,13 +35,7 @@ ] }, { - "name": null, "subnetResourceId": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001", - "loadBalancerBackendAddressPools": [ - { - "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/loadBalancers/adp-<>-az-lb-internal-001/backendAddressPools/servers" - } - ], "applicationSecurityGroups": [ { "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<>-az-asg-x-001" From 39ae0883f9683261fb443104f9a30aa51a2594a8 Mon Sep 17 00:00:00 2001 From: milescattini Date: Sun, 28 Aug 2022 18:38:29 +1000 Subject: [PATCH 7/8] update empty name check to match style of project --- modules/Microsoft.Network/networkInterfaces/deploy.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/networkInterfaces/deploy.bicep b/modules/Microsoft.Network/networkInterfaces/deploy.bicep index a324366739..fe29816550 100644 --- a/modules/Microsoft.Network/networkInterfaces/deploy.bicep +++ b/modules/Microsoft.Network/networkInterfaces/deploy.bicep @@ -100,7 +100,7 @@ resource networkInterface 'Microsoft.Network/networkInterfaces@2021-08-01' = { id: networkSecurityGroupResourceId } : null ipConfigurations: [for (ipConfiguration, index) in ipConfigurations: { - name: !empty(ipConfiguration.name) ? ipConfiguration.name : 'ipconfig-${index}' + name: contains(ipConfiguration, 'name') ? ipConfiguration.name : 'ipconfig0${index + 1}' properties: { primary: index == 0 ? true : false privateIPAllocationMethod: contains(ipConfiguration, 'privateIPAllocationMethod') ? (!empty(ipConfiguration.privateIPAllocationMethod) ? ipConfiguration.privateIPAllocationMethod : null) : null From 69c99b61d8bdf2994f6f7686f1162dd2b29e12f4 Mon Sep 17 00:00:00 2001 From: milescattini Date: Sun, 28 Aug 2022 18:41:14 +1000 Subject: [PATCH 8/8] update readme to match PR --- .../Microsoft.Network/networkInterfaces/readme.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/modules/Microsoft.Network/networkInterfaces/readme.md b/modules/Microsoft.Network/networkInterfaces/readme.md index 1d26ab762a..a5c2794158 100644 --- a/modules/Microsoft.Network/networkInterfaces/readme.md +++ b/modules/Microsoft.Network/networkInterfaces/readme.md @@ -273,12 +273,6 @@ module networkInterfaces './Microsoft.Network/networkInterfaces/deploy.bicep' = id: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<>-az-asg-x-001' } ] - loadBalancerBackendAddressPools: [ - { - id: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/loadBalancers/adp-<>-az-lb-internal-001/backendAddressPools/servers' - } - ] - name: null subnetResourceId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001' } ] @@ -337,12 +331,6 @@ module networkInterfaces './Microsoft.Network/networkInterfaces/deploy.bicep' = "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/applicationSecurityGroups/adp-<>-az-asg-x-001" } ], - "loadBalancerBackendAddressPools": [ - { - "id": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/loadBalancers/adp-<>-az-lb-internal-001/backendAddressPools/servers" - } - ], - "name": null, "subnetResourceId": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-001" } ]