diff --git a/docs/wiki/Example-1-Hub-and-Spoke.md b/docs/wiki/Example-1-Hub-and-Spoke.md index de693270..0f691ea0 100644 --- a/docs/wiki/Example-1-Hub-and-Spoke.md +++ b/docs/wiki/Example-1-Hub-and-Spoke.md @@ -11,7 +11,7 @@ targetScope = 'managementGroup' @description('Specifies the location for resources.') param location string = 'uksouth' -module sub003 'br/public:lz/sub-vending:1.1.1' = { +module sub003 'br/public:lz/sub-vending:1.1.2' = { name: 'sub-bicep-lz-vending-example-001' params: { subscriptionAliasEnabled: true diff --git a/docs/wiki/Example-2-Virtual-WAN.md b/docs/wiki/Example-2-Virtual-WAN.md index 42d46ab8..0f59b5d2 100644 --- a/docs/wiki/Example-2-Virtual-WAN.md +++ b/docs/wiki/Example-2-Virtual-WAN.md @@ -11,7 +11,7 @@ targetScope = 'managementGroup' @description('Specifies the location for resources.') param location string = 'uksouth' -module sub002 'br/public:lz/sub-vending:1.1.1' = { +module sub002 'br/public:lz/sub-vending:1.1.2' = { name: 'sub-bicep-lz-vending-example-002' params: { subscriptionAliasEnabled: true diff --git a/docs/wiki/Example-3-Use-With-Existing-Subscriptions.md b/docs/wiki/Example-3-Use-With-Existing-Subscriptions.md index 81a91081..0cdbdfc7 100644 --- a/docs/wiki/Example-3-Use-With-Existing-Subscriptions.md +++ b/docs/wiki/Example-3-Use-With-Existing-Subscriptions.md @@ -11,7 +11,7 @@ targetScope = 'managementGroup' @description('Specifies the location for resources.') param location string = 'uksouth' -module sub003 'br/public:lz/sub-vending:1.1.1' = { +module sub003 'br/public:lz/sub-vending:1.1.2' = { name: 'sub003' params: { subscriptionAliasEnabled: false diff --git a/main.bicep b/main.bicep index 04db029f..b0bd63e9 100644 --- a/main.bicep +++ b/main.bicep @@ -442,7 +442,7 @@ module createSubscription 'src/self/Microsoft.Subscription/aliases/deploy.bicep' } } -module createSubscriptionResources 'src/self/subResourceWrapper/deploy.bicep' = if ((subscriptionAliasEnabled || !empty(existingSubscriptionId)) && virtualNetworkEnabled && !empty(virtualNetworkResourceGroupName)) { +module createSubscriptionResources 'src/self/subResourceWrapper/deploy.bicep' = if (subscriptionAliasEnabled || !empty(existingSubscriptionId)) { name: deploymentNames.createSubscriptionResources params: { subscriptionId: (subscriptionAliasEnabled && empty(existingSubscriptionId)) ? createSubscription.outputs.subscriptionId : existingSubscriptionId @@ -467,6 +467,7 @@ module createSubscriptionResources 'src/self/subResourceWrapper/deploy.bicep' = virtualNetworkVwanPropagatedLabels: virtualNetworkVwanPropagatedLabels roleAssignmentEnabled: roleAssignmentEnabled roleAssignments: roleAssignments + disableTelemetry: disableTelemetry } } diff --git a/src/self/subResourceWrapper/deploy.bicep b/src/self/subResourceWrapper/deploy.bicep index 33230bfc..6464bf24 100644 --- a/src/self/subResourceWrapper/deploy.bicep +++ b/src/self/subResourceWrapper/deploy.bicep @@ -29,7 +29,7 @@ param virtualNetworkEnabled bool = false @maxLength(90) @sys.description('The name of the resource group to create the virtual network in.') -param virtualNetworkResourceGroupName string +param virtualNetworkResourceGroupName string = '' @sys.description('Enables the deployment of a `CanNotDelete` resource locks to the virtual networks resource group.') param virtualNetworkResourceGroupLockEnabled bool = true @@ -80,6 +80,9 @@ param roleAssignmentEnabled bool = false @sys.description('Supply an array of objects containing the details of the role assignments to create.') param roleAssignments array = [] +@sys.description('Disable telemetry collection by this module. For more information on the telemetry collected by this module, that is controlled by this parameter, see this page in the wiki: [Telemetry Tracking Using Customer Usage Attribution (PID)](https://github.com/Azure/bicep-lz-vending/wiki/Telemetry)') +param disableTelemetry bool = false + // VARIABLES // Deployment name variables @@ -110,6 +113,9 @@ var virutalWanHubDefaultRouteTableId = { var virtualWanHubConnectionPropogatedRouteTables = !empty(virtualNetworkVwanPropagatedRouteTablesResourceIds) ? virtualNetworkVwanPropagatedRouteTablesResourceIds : array(virutalWanHubDefaultRouteTableId) var virtualWanHubConnectionPropogatedLabels = !empty(virtualNetworkVwanPropagatedLabels) ? virtualNetworkVwanPropagatedLabels : [ 'default' ] +// Telemetry for CARML flip +var enableTelemetryForCarml = !disableTelemetry + // RESOURCES & MODULES module moveSubscriptionToManagementGroup '../Microsoft.Management/managementGroups/subscriptions/deploy.bicep' = if (subscriptionManagementGroupAssociationEnabled && !empty(subscriptionManagementGroupId)) { @@ -129,6 +135,7 @@ module tagSubscription '../../carml/v0.6.0/Microsoft.Resources/tags/deploy.bicep location: virtualNetworkLocation onlyUpdate: true tags: subscriptionTags + enableDefaultTelemetry: enableTelemetryForCarml } } @@ -139,6 +146,7 @@ module createResourceGroupForLzNetworking '../../carml/v0.6.0/Microsoft.Resource name: virtualNetworkResourceGroupName location: virtualNetworkLocation lock: virtualNetworkResourceGroupLockEnabled ? 'CanNotDelete' : '' + enableDefaultTelemetry: enableTelemetryForCarml } } @@ -153,6 +161,7 @@ module tagResourceGroup '../../carml/v0.6.0/Microsoft.Resources/tags/deploy.bice resourceGroupName: virtualNetworkResourceGroupName onlyUpdate: true tags: virtualNetworkResourceGroupTags + enableDefaultTelemetry: enableTelemetryForCarml } } @@ -169,7 +178,7 @@ module createLzVnet '../../carml/v0.6.0/Microsoft.Network/virtualNetworks/deploy addressPrefixes: virtualNetworkAddressSpace dnsServers: virtualNetworkDnsServers ddosProtectionPlanId: virtualNetworkDdosPlanId - virtualNetworkPeerings: (virtualNetworkPeeringEnabled && !empty(hubVirtualNetworkResourceIdChecked)) ? [ + virtualNetworkPeerings: (virtualNetworkEnabled && virtualNetworkPeeringEnabled && !empty(hubVirtualNetworkResourceIdChecked) && !empty(virtualNetworkName) && !empty(virtualNetworkAddressSpace) && !empty(virtualNetworkLocation) && !empty(virtualNetworkResourceGroupName)) ? [ { allowForwardedTraffic: true allowVirtualNetworkAccess: true @@ -183,10 +192,11 @@ module createLzVnet '../../carml/v0.6.0/Microsoft.Network/virtualNetworks/deploy remotePeeringUseRemoteGateways: false } ] : [] + enableDefaultTelemetry: enableTelemetryForCarml } } -module createLzVirtualWanConnection '../../carml/v0.6.0/Microsoft.Network/virtualHubs/hubVirtualNetworkConnections/deploy.bicep' = if (virtualNetworkEnabled && virtualNetworkPeeringEnabled && !empty(virtualHubResourceIdChecked)) { +module createLzVirtualWanConnection '../../carml/v0.6.0/Microsoft.Network/virtualHubs/hubVirtualNetworkConnections/deploy.bicep' = if (virtualNetworkEnabled && virtualNetworkPeeringEnabled && !empty(virtualHubResourceIdChecked) && !empty(virtualNetworkName) && !empty(virtualNetworkAddressSpace) && !empty(virtualNetworkLocation) && !empty(virtualNetworkResourceGroupName) && !empty(virtualWanHubResourceGroupName) && !empty(virtualWanHubSubscriptionId)) { dependsOn: [ createResourceGroupForLzNetworking ] @@ -195,7 +205,7 @@ module createLzVirtualWanConnection '../../carml/v0.6.0/Microsoft.Network/virtua params: { name: virtualWanHubConnectionName virtualHubName: virtualWanHubName - remoteVirtualNetworkId: createLzVnet.outputs.resourceId + remoteVirtualNetworkId: '/subscriptions/${subscriptionId}/resourceGroups/${virtualNetworkResourceGroupName}/providers/Microsoft.Network/virtualNetworks/${virtualNetworkName}' routingConfiguration: { associatedRouteTable: { id: virtualWanHubConnectionAssociatedRouteTable @@ -205,6 +215,7 @@ module createLzVirtualWanConnection '../../carml/v0.6.0/Microsoft.Network/virtua labels: virtualWanHubConnectionPropogatedLabels } } + enableDefaultTelemetry: enableTelemetryForCarml } } @@ -219,6 +230,7 @@ module createLzRoleAssignments '../../carml/v0.6.0/Microsoft.Authorization/roleA roleDefinitionIdOrName: assignment.definition subscriptionId: subscriptionId resourceGroupName: (contains(assignment.relativeScope, '/resourceGroups/') ? split(assignment.relativeScope, '/')[2] : '') + enableDefaultTelemetry: enableTelemetryForCarml } }] diff --git a/src/self/subResourceWrapper/readme.md b/src/self/subResourceWrapper/readme.md index 7c6c4faa..2a643fa1 100644 --- a/src/self/subResourceWrapper/readme.md +++ b/src/self/subResourceWrapper/readme.md @@ -15,7 +15,7 @@ subscriptionManagementGroupAssociationEnabled | No | Whether to move the s subscriptionManagementGroupId | No | The destination management group ID for the new subscription. Note: Do not supply the display name. The management group ID forms part of the Azure resource ID. e.g., `/providers/Microsoft.Management/managementGroups/{managementGroupId}`. subscriptionTags | No | An object of tag key/value pairs to be appended to a subscription. NOTE: Tags will only be overwriten if existing tag exists with same key; values provided here win. virtualNetworkEnabled | No | Whether to create a virtual network or not. -virtualNetworkResourceGroupName | Yes | The name of the resource group to create the virtual network in. +virtualNetworkResourceGroupName | No | The name of the resource group to create the virtual network in. virtualNetworkResourceGroupLockEnabled | No | Enables the deployment of a `CanNotDelete` resource locks to the virtual networks resource group. virtualNetworkResourceGroupTags | No | An object of tag key/value pairs to be appended to the Resource Group that the Virtual Network is created in. NOTE: Tags will only be overwriten if existing tag exists with same key; values provided here win. virtualNetworkLocation | No | The location of the virtual network. Use region shortnames e.g. uksouth, eastus, etc. @@ -32,6 +32,7 @@ virtualNetworkVwanPropagatedRouteTablesResourceIds | No | An array of virt virtualNetworkVwanPropagatedLabels | No | An array of virtual hub route table labels to propogate routes to. If left blank/empty default label will be propogated to only. roleAssignmentEnabled | No | Whether to create role assignments or not. If true, supply the array of role assignment objects in the parameter called `roleAssignments`. roleAssignments | No | Supply an array of objects containing the details of the role assignments to create. +disableTelemetry | No | Disable telemetry collection by this module. For more information on the telemetry collected by this module, that is controlled by this parameter, see this page in the wiki: [Telemetry Tracking Using Customer Usage Attribution (PID)](https://github.com/Azure/bicep-lz-vending/wiki/Telemetry) ### subscriptionId @@ -69,7 +70,7 @@ Whether to create a virtual network or not. ### virtualNetworkResourceGroupName -![Parameter Setting](https://img.shields.io/badge/parameter-required-orange?style=flat-square) +![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square) The name of the resource group to create the virtual network in. @@ -179,6 +180,14 @@ Whether to create role assignments or not. If true, supply the array of role ass Supply an array of objects containing the details of the role assignments to create. +### disableTelemetry + +![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square) + +Disable telemetry collection by this module. For more information on the telemetry collected by this module, that is controlled by this parameter, see this page in the wiki: [Telemetry Tracking Using Customer Usage Attribution (PID)](https://github.com/Azure/bicep-lz-vending/wiki/Telemetry) + +- Default value: `False` + ## Snippets ### Parameter file @@ -256,6 +265,9 @@ Supply an array of objects containing the details of the role assignments to cre }, "roleAssignments": { "value": [] + }, + "disableTelemetry": { + "value": false } } }