From 839a18664d01cf2cc8c25a8bb4f3d9aff403d257 Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Fri, 7 Feb 2025 18:14:43 +0100 Subject: [PATCH] subnet telemetry and version updates --- avm/res/network/virtual-network/main.bicep | 3 ++ avm/res/network/virtual-network/main.json | 47 +++++++++++++++---- .../network/virtual-network/subnet/README.md | 14 ++++++ .../network/virtual-network/subnet/main.bicep | 22 +++++++++ .../network/virtual-network/subnet/main.json | 31 +++++++++++- .../virtual-network/subnet/version.json | 7 +++ avm/res/network/virtual-network/version.json | 2 +- .../virtual-network-peering/main.json | 4 +- 8 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 avm/res/network/virtual-network/subnet/version.json diff --git a/avm/res/network/virtual-network/main.bicep b/avm/res/network/virtual-network/main.bicep index 6701e10141..f8808e2c9d 100644 --- a/avm/res/network/virtual-network/main.bicep +++ b/avm/res/network/virtual-network/main.bicep @@ -60,6 +60,8 @@ param enableTelemetry bool = true @description('Optional. Indicates if VM protection is enabled for all the subnets in the virtual network.') param enableVmProtection bool? +var enableReferencedModulesTelemetry = false + var builtInRoleNames = { Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c') 'Network Contributor': subscriptionResourceId( @@ -168,6 +170,7 @@ module virtualNetwork_subnets 'subnet/main.bicep' = [ serviceEndpoints: subnet.?serviceEndpoints defaultOutboundAccess: subnet.?defaultOutboundAccess sharingScope: subnet.?sharingScope + enableTelemetry: enableReferencedModulesTelemetry } } ] diff --git a/avm/res/network/virtual-network/main.json b/avm/res/network/virtual-network/main.json index e81d0e5bb2..136747474d 100644 --- a/avm/res/network/virtual-network/main.json +++ b/avm/res/network/virtual-network/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.32.4.45862", - "templateHash": "2376075998560091019" + "version": "0.33.13.18514", + "templateHash": "17461823572424139738" }, "name": "Virtual Networks", "description": "This module deploys a Virtual Network (vNet)." @@ -627,6 +627,7 @@ "input": "[union(coalesce(parameters('roleAssignments'), createArray())[copyIndex('formattedRoleAssignments')], createObject('roleDefinitionId', coalesce(tryGet(variables('builtInRoleNames'), coalesce(parameters('roleAssignments'), createArray())[copyIndex('formattedRoleAssignments')].roleDefinitionIdOrName), if(contains(coalesce(parameters('roleAssignments'), createArray())[copyIndex('formattedRoleAssignments')].roleDefinitionIdOrName, '/providers/Microsoft.Authorization/roleDefinitions/'), coalesce(parameters('roleAssignments'), createArray())[copyIndex('formattedRoleAssignments')].roleDefinitionIdOrName, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', coalesce(parameters('roleAssignments'), createArray())[copyIndex('formattedRoleAssignments')].roleDefinitionIdOrName)))))]" } ], + "enableReferencedModulesTelemetry": false, "builtInRoleNames": { "Contributor": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]", "Network Contributor": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4d97b98b-1d4f-4787-a291-c67834d212e7')]", @@ -816,6 +817,9 @@ }, "sharingScope": { "value": "[tryGet(coalesce(parameters('subnets'), createArray())[copyIndex()], 'sharingScope')]" + }, + "enableTelemetry": { + "value": "[variables('enableReferencedModulesTelemetry')]" } }, "template": { @@ -825,8 +829,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.32.4.45862", - "templateHash": "6924527964815690853" + "version": "0.33.13.18514", + "templateHash": "15508131240272677845" }, "name": "Virtual Network Subnets", "description": "This module deploys a Virtual Network Subnet." @@ -1041,6 +1045,13 @@ "metadata": { "description": "Optional. Array of role assignments to create." } + }, + "enableTelemetry": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Optional. Enable/Disable usage telemetry for module." + } } }, "variables": { @@ -1061,6 +1072,26 @@ } }, "resources": { + "avmTelemetry": { + "condition": "[parameters('enableTelemetry')]", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2024-03-01", + "name": "[format('46d3xbcp.res.network-virtualnetworksubnet.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name), 0, 4))]", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [], + "outputs": { + "telemetry": { + "type": "String", + "value": "For more information, see https://aka.ms/avm/TelemetryInfo" + } + } + } + } + }, "virtualNetwork": { "existing": true, "type": "Microsoft.Network/virtualNetworks", @@ -1206,8 +1237,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.32.4.45862", - "templateHash": "6667873480569726785" + "version": "0.33.13.18514", + "templateHash": "3926757544002464477" }, "name": "Virtual Network Peerings", "description": "This module deploys a Virtual Network Peering." @@ -1363,8 +1394,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.32.4.45862", - "templateHash": "6667873480569726785" + "version": "0.33.13.18514", + "templateHash": "3926757544002464477" }, "name": "Virtual Network Peerings", "description": "This module deploys a Virtual Network Peering." diff --git a/avm/res/network/virtual-network/subnet/README.md b/avm/res/network/virtual-network/subnet/README.md index 3bc00d1f21..be8bb676b4 100644 --- a/avm/res/network/virtual-network/subnet/README.md +++ b/avm/res/network/virtual-network/subnet/README.md @@ -9,6 +9,7 @@ This module deploys a Virtual Network Subnet. - [Outputs](#Outputs) - [Cross-referenced modules](#Cross-referenced-modules) - [Notes](#Notes) +- [Data Collection](#Data-Collection) ## Resource Types @@ -40,6 +41,7 @@ This module deploys a Virtual Network Subnet. | [`applicationGatewayIPConfigurations`](#parameter-applicationgatewayipconfigurations) | array | Application gateway IP configurations of virtual network resource. | | [`defaultOutboundAccess`](#parameter-defaultoutboundaccess) | bool | Set this property to false to disable default outbound connectivity for all VMs in the subnet. This property can only be set at the time of subnet creation and cannot be updated for an existing subnet. | | [`delegation`](#parameter-delegation) | string | The delegation to enable on the subnet. | +| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. | | [`natGatewayResourceId`](#parameter-natgatewayresourceid) | string | The resource ID of the NAT Gateway to use for the subnet. | | [`networkSecurityGroupResourceId`](#parameter-networksecuritygroupresourceid) | string | The resource ID of the network security group to assign to the subnet. | | [`privateEndpointNetworkPolicies`](#parameter-privateendpointnetworkpolicies) | string | Enable or disable apply network policies on private endpoint in the subnet. | @@ -100,6 +102,14 @@ The delegation to enable on the subnet. - Required: No - Type: string +### Parameter: `enableTelemetry` + +Enable/Disable usage telemetry for module. + +- Required: No +- Type: bool +- Default: `True` + ### Parameter: `natGatewayResourceId` The resource ID of the NAT Gateway to use for the subnet. @@ -306,3 +316,7 @@ This section gives you an overview of all local-referenced module files (i.e., o ## Notes The `privateEndpointNetworkPolicies` property must be set to disabled for subnets that contain private endpoints. It confirms that NSGs rules will not apply to private endpoints (currently not supported, [reference](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview#limitations)). Default Value when not specified is "Enabled". + +## Data Collection + +The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at . You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. diff --git a/avm/res/network/virtual-network/subnet/main.bicep b/avm/res/network/virtual-network/subnet/main.bicep index 70d9b6320f..bf52386dc3 100644 --- a/avm/res/network/virtual-network/subnet/main.bicep +++ b/avm/res/network/virtual-network/subnet/main.bicep @@ -60,6 +60,9 @@ import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.2 @description('Optional. Array of role assignments to create.') param roleAssignments roleAssignmentType[]? +@description('Optional. Enable/Disable usage telemetry for module.') +param enableTelemetry bool = true + var builtInRoleNames = { Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c') 'Network Contributor': subscriptionResourceId( @@ -89,6 +92,25 @@ var formattedRoleAssignments = [ }) ] +#disable-next-line no-deployments-resources +resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableTelemetry) { + name: '46d3xbcp.res.network-virtualnetworksubnet.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name), 0, 4)}' + properties: { + mode: 'Incremental' + template: { + '$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#' + contentVersion: '1.0.0.0' + resources: [] + outputs: { + telemetry: { + type: 'String' + value: 'For more information, see https://aka.ms/avm/TelemetryInfo' + } + } + } + } +} + resource virtualNetwork 'Microsoft.Network/virtualNetworks@2024-01-01' existing = { name: virtualNetworkName } diff --git a/avm/res/network/virtual-network/subnet/main.json b/avm/res/network/virtual-network/subnet/main.json index 44761e1d2b..278e7d4131 100644 --- a/avm/res/network/virtual-network/subnet/main.json +++ b/avm/res/network/virtual-network/subnet/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.32.4.45862", - "templateHash": "6924527964815690853" + "version": "0.33.13.18514", + "templateHash": "15508131240272677845" }, "name": "Virtual Network Subnets", "description": "This module deploys a Virtual Network Subnet." @@ -221,6 +221,13 @@ "metadata": { "description": "Optional. Array of role assignments to create." } + }, + "enableTelemetry": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Optional. Enable/Disable usage telemetry for module." + } } }, "variables": { @@ -241,6 +248,26 @@ } }, "resources": { + "avmTelemetry": { + "condition": "[parameters('enableTelemetry')]", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2024-03-01", + "name": "[format('46d3xbcp.res.network-virtualnetworksubnet.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name), 0, 4))]", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [], + "outputs": { + "telemetry": { + "type": "String", + "value": "For more information, see https://aka.ms/avm/TelemetryInfo" + } + } + } + } + }, "virtualNetwork": { "existing": true, "type": "Microsoft.Network/virtualNetworks", diff --git a/avm/res/network/virtual-network/subnet/version.json b/avm/res/network/virtual-network/subnet/version.json new file mode 100644 index 0000000000..1c884ecaa9 --- /dev/null +++ b/avm/res/network/virtual-network/subnet/version.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://aka.ms/bicep-registry-module-version-file-schema#", + "version": "0.1", + "pathFilters": [ + "./main.json" + ] +} \ No newline at end of file diff --git a/avm/res/network/virtual-network/version.json b/avm/res/network/virtual-network/version.json index ea4f3b6e67..21226dd43f 100644 --- a/avm/res/network/virtual-network/version.json +++ b/avm/res/network/virtual-network/version.json @@ -1,6 +1,6 @@ { "$schema": "https://aka.ms/bicep-registry-module-version-file-schema#", - "version": "0.5", + "version": "0.6", "pathFilters": [ "./main.json" ] diff --git a/avm/res/network/virtual-network/virtual-network-peering/main.json b/avm/res/network/virtual-network/virtual-network-peering/main.json index ee192848f9..7746e83682 100644 --- a/avm/res/network/virtual-network/virtual-network-peering/main.json +++ b/avm/res/network/virtual-network/virtual-network-peering/main.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.32.4.45862", - "templateHash": "6667873480569726785" + "version": "0.33.13.18514", + "templateHash": "3926757544002464477" }, "name": "Virtual Network Peerings", "description": "This module deploys a Virtual Network Peering."