### Hub Networking Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/hubNetworking/generateddocs/hubNetworking-multiRegion.bicep.md Example of a parameter file used to configure multi-region hub networking. This includes settings for VPN gateways, BGP, DNS forwarding, and Bastion ports. ```json { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "parameters": { "parHubNetworkingName": { "value": "hub-networking-prod-eus2" }, "parHubNetworkingLocation": { "value": "eastus2" }, "parHubNetworkingResourceGroup": { "value": "hub-networking-prod-eus2" }, "parHubNetworkingTags": { "value": { "environment": "production", "region": "eastus2" } }, "parHubNetworkingVirtualNetworkCidr": { "value": "10.1.0.0/16" }, "parHubNetworkingVirtualNetworkName": { "value": "vnet-hub-networking-prod-eus2" }, "parHubNetworkingVirtualNetworkTags": { "value": { "environment": "production", "region": "eastus2" } }, "parHubNetworkingVirtualNetworkGatewayType": { "value": "Vpn" }, "parHubNetworkingVirtualNetworkGatewaySku": { "value": "VpnGw1" }, "parHubNetworkingVirtualNetworkGatewayGeneration": { "value": "None" }, "enableBgp": { "value": false }, "activeActive": { "value": false }, "enableBgpRouteTranslationForNat": { "value": false }, "enableDnsForwarding": { "value": false }, "bgpPeeringAddress": { "value": "" }, "bgpSettings": { "value": { "asn": 65515, "bgpPeeringAddress": "", "peerWeight": 5 } }, "ipConfigurationName": { "value": "vnetGatewayConfig" }, "ipConfigurationActiveActiveName": { "value": "vnetGatewayConfig2" } } } ``` -------------------------------- ### JSON Parameter File Input Example for Subscription Placement Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/orchestration/subPlacementAll/README.md Example of how to define subscription placements for landing zones and platform management groups in a JSON parameter file. Keys match the last part of the Management Group ID. ```json "parLandingZoneMgChildrenSubs": { "value": { "pci": { "subscriptions": [ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy" ] }, "another-example": { "subscriptions": [ "zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz" ] } } }, "parPlatformMgChildrenSubs": { "value": { "security": { "subscriptions": [ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy" ] }, "yet-another-example": { "subscriptions": [ "zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz" ] } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/policy/samples/generateddocs/minimum.sample.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the metadata.template path is correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/policy/samples/minimum.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/vnetPeeringVwan/samples/generateddocs/minimum.sample.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the 'contentVersion' and 'metadata' fields are correctly set for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/vnetPeeringVwan/samples/minimum.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/CRML/customerUsageAttribution/generateddocs/cuaIdResourceGroup.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the metadata.template path is correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdResourceGroup.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/CRML/customerUsageAttribution/generateddocs/cuaIdSubscription.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the metadata.template path is correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdSubscription.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Input Example for Subscription Placement Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/orchestration/subPlacementAll/README.md Example of how to define subscription placements for landing zones and platform management groups using Bicep. Keys match the last part of the Management Group ID. ```bicep parLandingZoneMgChildrenSubs: { pci: { subscriptions: [ 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy' ] } 'another-example': { subscriptions: [ 'zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz' ] } } parPlatformMgChildrenSubs: { security: { subscriptions: [ 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy' ] } 'yet-another-example': { subscriptions: [ 'zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz' ] } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/subscriptionPlacement/samples/generateddocs/minimum.sample.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/subscriptionPlacement/samples/minimum.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/resourceGroup/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/resourceGroup/samples/baseline.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/hubNetworking/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. It includes the schema, version, metadata, and parameter values, such as the deployment location. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/hubNetworking/samples/baseline.sample.json" }, "parameters": { "location": { "value": "[resourceGroup().location]" } } } ``` -------------------------------- ### Virtual Network Peering Deployment Parameters Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/vnetPeering/generateddocs/vnetPeering.bicep.md Example parameter file for deploying the Virtual Network Peering module. Ensure all required parameters are provided with appropriate values. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/vnetPeering/vnetPeering.json" }, "parameters": { "parDestinationVirtualNetworkId": { "value": "" }, "parSourceVirtualNetworkName": { "value": "" }, "parDestinationVirtualNetworkName": { "value": "" }, "parAllowVirtualNetworkAccess": { "value": true }, "parAllowForwardedTraffic": { "value": true }, "parAllowGatewayTransit": { "value": false }, "parUseRemoteGateways": { "value": false }, "parTelemetryOptOut": { "value": false } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/vnetPeeringVwan/samples/generateddocs/baseline.sample.bicep.md This JSON defines parameters for a Bicep deployment. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/vnetPeeringVwan/samples/baseline.sample.json" }, "parameters": {} } ``` -------------------------------- ### Example Bicep File Structure Source: https://github.com/azure/alz-bicep/wiki/Contributing This Bicep file demonstrates a recommended structure including scope, metadata, types, parameters, variables, resource deployments, and outputs. It's designed for deployment at the subscription scope. ```bicep // SCOPE targetScope = 'subscription' //Deploying at Subscription scope to allow resource groups to be created and resources in one deployment // METADATA metadata name = 'ALZ Bicep - Example Module' metadata description = 'ALZ Bicep Module used as an example' // TYPES @minValue(0) type typExampleNonNegativeInteger = int // PARAMETERS @sys.description('Example description for parameter.') // Avoid describing default values param parExampleResourceGroupNamePrefix string = 'TEST' // VARIABLES var varExampleResourceGroupName = 'rsg-${parExampleResourceGroupNamePrefix}' // Create name for the example resource group // RESOURCE DEPLOYMENTS resource resExampleResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { name: varExampleResourceGroupName location: 'uksouth' // Hardcoded as an example of commenting inside a resource } /* No modules being deployed in this example */ // OUTPUTS output outResourceGroupExampleID string = resExampleResourceGroup.id ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/managementGroups/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/managementGroups/samples/baseline.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/policy/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/policy/samples/baseline.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/vnetPeering/samples/generateddocs/baseline.sample.bicep.md This JSON defines the parameters for a Bicep deployment. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/vnetPeering/samples/baseline.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/vwanConnectivity/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. It specifies the schema, version, metadata, and parameter values, such as the deployment location. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/vwanConnectivity/samples/baseline.sample.json" }, "parameters": { "parLocation": { "value": "westus" } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/logging/samples/generateddocs/minimum.sample.bicep.md This JSON defines the parameters for a Bicep deployment, including the deployment location. It references a specific template for metadata. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/logging/samples/minimum.sample.json" }, "parameters": { "location": { "value": "[resourceGroup().location]" } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/CRML/customerUsageAttribution/generateddocs/cuaIdManagementGroup.bicep.md This JSON file defines parameters for a Bicep template deployment. Ensure the 'metadata.template' path correctly points to your Bicep file. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdManagementGroup.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/spokeNetworking/samples/generateddocs/minimum.sample.bicep.md This JSON file defines parameters for a Bicep deployment. It specifies the schema, version, metadata, and parameter values, such as the deployment location. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/spokeNetworking/samples/minimum.sample.json" }, "parameters": { "location": { "value": "eastus" } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/publicIp/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. It includes the schema, version, metadata, and specific parameter values, such as the deployment location. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/publicIp/samples/baseline.sample.json" }, "parameters": { "location": { "value": "[resourceGroup().location]" } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/roleAssignments/samples/generateddocs/minimum.sample.bicep.md This is a basic structure for a Bicep parameter file. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/roleAssignments/samples/minimum.sample.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/CRML/customerUsageAttribution/generateddocs/cuaIdTenant.bicep.md This JSON file defines parameters for a Bicep deployment. Ensure the schema and contentVersion are correct for your deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdTenant.json" }, "parameters": {} } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/publicIp/samples/generateddocs/minimum.sample.bicep.md This JSON file defines parameters for a Bicep deployment. It includes the schema, version, metadata, and specific parameter values, such as the deployment location. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/publicIp/samples/minimum.sample.json" }, "parameters": { "location": { "value": "[resourceGroup().location]" } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/logging/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. It specifies the schema, version, metadata, and parameter values, including the deployment location. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/logging/samples/baseline.sample.json" }, "parameters": { "location": { "value": "[resourceGroup().location]" } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/spokeNetworking/samples/generateddocs/baseline.sample.bicep.md This JSON file defines parameters for a Bicep deployment. It specifies the schema, version, metadata about the template, and the values for the parameters, such as the deployment location. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/spokeNetworking/samples/baseline.sample.json" }, "parameters": { "location": { "value": "eastus" } } } ``` -------------------------------- ### Bicep Example for Custom Landing Zone and Platform Management Groups Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/managementGroups/README.md Demonstrates how to use the `parLandingZoneMgChildren` and `parPlatformMgChildren` parameters in Bicep to define custom child management groups. ```bicep parLandingZoneMgChildren: { pci: { displayName: 'PCI' } 'another-example': { displayName: 'Another Example' } } parPlatformMgChildren: { security: { displayName: 'Security' } 'yet-another-example': { displayName: 'Yet Another Example' } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/vwanConnectivity/samples/generateddocs/minimum.sample.bicep.md This JSON file defines parameters for an Azure Bicep deployment. It specifies the schema, version, metadata, and the values for parameters like 'location'. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/vwanConnectivity/samples/minimum.sample.json" }, "parameters": { "location": { "value": "westus" } } } ``` -------------------------------- ### Bicep Management Groups Parameter File Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/managementGroups/generateddocs/managementGroupsScopeEscape.bicep.md Example parameter file for deploying management groups using Bicep. Configure management group prefixes, display names, and hierarchy settings. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/managementGroups/managementGroupsScopeEscape.json" }, "parameters": { "parTopLevelManagementGroupPrefix": { "value": "alz" }, "parTopLevelManagementGroupSuffix": { "value": "" }, "parTopLevelManagementGroupDisplayName": { "value": "Azure Landing Zones" }, "parTopLevelManagementGroupParentId": { "value": "" }, "parLandingZoneMgAlzDefaultsEnable": { "value": true }, "parPlatformMgAlzDefaultsEnable": { "value": true }, "parLandingZoneMgConfidentialEnable": { "value": false }, "parLandingZoneMgChildren": { "value": {} }, "parPlatformMgChildren": { "value": {} }, "parTelemetryOptOut": { "value": false } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/hubNetworking/samples/generateddocs/minimum.sample.bicep.md This JSON defines the parameters for a Bicep deployment, specifying the deployment location. It's commonly used to override default parameter values during deployment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/hubNetworking/samples/minimum.sample.json" }, "parameters": { "location": { "value": "[resourceGroup().location]" } } } ``` -------------------------------- ### Deploy Spoke Networking with Azure CLI Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/spokeNetworking/README.md Example deployment of the Spoke Networking module using Azure CLI for global Azure regions. Ensure the LandingZoneSubscriptionId and TopLevelMGPrefix are set according to your environment. ```bash # For Azure global regions # Set Azure Landing zone subscription ID as the the current subscription LandingZoneSubscriptionId="[your landing zone subscription ID]" az account set --subscription $LandingZoneSubscriptionId # Set the top level MG Prefix in accordance to your environment. This example assumes default 'alz'. TopLevelMGPrefix="alz" dateYMD=$(date +%Y%m%dT%H%M%S%NZ) NAME="alz-SpokeNetworkingDeployment-${dateYMD}" GROUP="rg-$TopLevelMGPrefix-spoke-networking-001" TEMPLATEFILE="infra-as-code/bicep/modules/spokeNetworking/spokeNetworking.bicep" PARAMETERS="@infra-as-code/bicep/modules/spokeNetworking/parameters/spokeNetworking.parameters.all.json" # Create Resource Group - optional when using an existing resource group az group create \ --name $GROUP \ --location eastus az deployment group create --name ${NAME:0:63} --resource-group $GROUP --template-file $TEMPLATEFILE --parameters $PARAMETERS ``` -------------------------------- ### Install ALZ PowerShell Module v3.1.2 Source: https://github.com/azure/alz-bicep/wiki/ClassicAccelerator To use the classic ALZ Bicep Accelerator, install version 3.1.2 of the Az PowerShell module. Uninstalling any current versions is recommended before installation. ```powershell # Uninstall current version (if needed) Uninstall-Module -Name Az -AllVersions -Force ``` ```powershell # Install a specific older version (3.1.2) Install-Module -Name Az -RequiredVersion 3.1.2 ``` -------------------------------- ### Deny Effect Example - Deny-Subnet-Without-Nsg Source: https://github.com/azure/alz-bicep/blob/main/docs/wiki/AssigningPolicies.md Example of a policy assignment module declaration for the 'Deny' effect. ```bicep module modPolAssiIdentDenySubnetWithoutNSG 'module/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep' = [ { name: 'modPolAssiIdentDenySubnetWithoutNSG' params: { "AlzEnvironment": "${varAlzEnvironment}" "parPolicyAssignmentParameterOverrides": { "Deny-Subnet-Without-Nsg": { "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/e1f3f97d-8307-4264-9f8c-c9590004370f" "policyAssignment": { "name": "Deny-Subnet-Without-Nsg" "displayName": "Deny subnet without NSG" "description": "Deny any subnet that does not have a Network Security Group associated with it." "metadata": { "category": "Network" } "identity": { "type": "None" } } } } } } ] ``` -------------------------------- ### Deny Effect Example - Deny-Subnet-Without-Nsg Source: https://github.com/azure/alz-bicep/wiki/AssigningPolicies Example of a policy assignment module declaration for the 'Deny' effect. ```bicep module modPolAssiIdentDenySubnetWithoutNSG 'module/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep' = [ for (item, index) in varModPolAssiIdentDenySubnetWithoutNSG { name: item.name params: { // Policy Assignment Parameters // ... parPolicyAssignmentParameterOverrides: item.parPolicyAssignmentParameterOverrides // ... } } ] ``` -------------------------------- ### DeployIfNotExists Effect Example - Deploy-MDFC-Config Source: https://github.com/azure/alz-bicep/blob/main/docs/wiki/AssigningPolicies.md Example of a policy assignment module declaration for the 'DeployIfNotExists' effect. Note the use of 'parPolicyAssignmentParameterOverrides'. ```bicep module modPolAssiIntRootDeployMDFCConfig 'module/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep' = [ { name: 'modPolAssiIntRootDeployMDFCConfig' params: { "AlzEnvironment": "${varAlzEnvironment}" "parPolicyAssignmentParameterOverrides": { "Deploy-MDFC-Config": { "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/81341f7a-1766-4317-8720-03331719736f" "policyAssignment": { "name": "Deploy-MDFC-Config" "displayName": "Deploy - Management Group Diagnostic Settings" "description": "Deploy diagnostic settings to management group scope." "metadata": { "category": "Monitoring" } "parameters": { "logCategories": { "value": [ "ActionLogs" "PolicyLogs" "AdministrativeLogs" "SecurityLogs" "ServiceHealthLogs" ] } "retentionInDays": { "value": 7 } "workspaceId": { "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/alz-monitoring-rg/providers/Microsoft.OperationalInsights/workspaces/alz-monitoring-workspace" } } "identity": { "type": "SystemAssigned" } } } } } } ] ``` -------------------------------- ### DeployIfNotExists Effect Example - Deploy-MDFC-Config Source: https://github.com/azure/alz-bicep/wiki/AssigningPolicies Example of a policy assignment module declaration for the 'DeployIfNotExists' effect. Note the use of 'parPolicyAssignmentParameterOverrides'. ```bicep module modPolAssiIntRootDeployMDFCConfig 'module/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep' = [ for (item, index) in varModPolAssiIntRootDeployMDFCConfig { name: item.name params: { // Policy Assignment Parameters // ... parPolicyAssignmentParameterOverrides: item.parPolicyAssignmentParameterOverrides // ... } } ] ``` -------------------------------- ### Install and Import PSDocs.Azure Module Source: https://github.com/azure/alz-bicep/wiki/Contributing This command installs the 'PSDocs.Azure' PowerShell module from the PSGallery and imports it. This module is a requirement for generating Bicep parameter markdown files. ```powershell Install-Module -Name 'PSDocs.Azure' -Repository PSGallery -force; Import-Module PSDocs.Azure -Force ``` -------------------------------- ### Example of Custom Policy Set Definition Array Variable Source: https://github.com/azure/alz-bicep/blob/main/docs/wiki/AddingPolicyDefs.md This example demonstrates how to manually add custom policy set definitions to the `varCustomPolicySetDefinitionsArray` variable in a Bicep file. Follow the schema for an array of objects. ```bicep varCustomPolicySetDefinitionsArray = [ { "name": "MyCustomPolicySet", "displayName": "My Custom Policy Set Display Name", "description": "My custom policy set description.", "metadata": { "category": "MyCustomCategory" }, "parameters": {}, "policyDefinitions": [ { "policyDefinitionReferenceId": "MyCustomPolicyRef", "policyDefinitionId": "/subscriptions/your_subscription_id/providers/Microsoft.Authorization/policyDefinitions/MyCustomPolicy" } ] } ] ``` -------------------------------- ### Example of Custom Policy Definition Array Variable Source: https://github.com/azure/alz-bicep/blob/main/docs/wiki/AddingPolicyDefs.md This example shows how to manually add custom policy definitions to the `varCustomPolicyDefinitionsArray` variable within a Bicep file. Ensure the structure adheres to the defined schema for an array of objects. ```bicep varCustomPolicyDefinitionsArray = [ { "name": "MyCustomPolicy", "mode": "Indexed", "displayName": "My Custom Policy Display Name", "description": "My custom policy description.", "metadata": { "category": "MyCustomCategory" }, "parameters": {}, "policyRule": { "if": { "field": "type", "equals": "Microsoft.Storage/storageAccounts" }, "then": { "effect": "Audit" } }, "version": "1.0.0" } ] ``` -------------------------------- ### Login to Azure using PowerShell Source: https://github.com/azure/alz-bicep/wiki/ACRDeployment Connect to your Azure account using PowerShell. Ensure you have the Azure PowerShell module installed. ```powershell Connect-AzAccount ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/generateddocs/baseline.sample.bicep.md This JSON file defines the parameters for a Bicep deployment, including resource IDs for spoke virtual networks and private DNS zones. Ensure the values match your Azure environment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/privateDnsZoneLinks/samples/baseline.sample.json" }, "parameters": { "parSpokeVirtualNetworkResourceId": { "value": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups//providers/Microsoft.Network/virtualNetworks/" }, "parPrivateDnsZoneResourceId": { "value": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups//providers/Microsoft.Network/privateDnsZones/" } } } ``` -------------------------------- ### PowerShell: Deploy Management Groups (China) Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/managementGroups/README.md Use this PowerShell script to deploy management groups for Azure China regions. This example uses the `managementGroups.bicep` template. ```powershell # For Azure China regions $inputObject = @{ DeploymentName = -join ('alz-MGDeployment-{0}' -f (Get-Date -Format 'yyyyMMddTHHMMssffffZ'))[0..63] Location = 'chinaeast2' TemplateFile = "infra-as-code/bicep/modules/managementGroups/managementGroups.bicep" TemplateParameterFile = 'infra-as-code/bicep/modules/managementGroups/parameters/managementGroups.parameters.all.json' } New-AzTenantDeployment @inputObject ``` -------------------------------- ### PowerShell: Deploy Management Groups (Global) Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/managementGroups/README.md Use this PowerShell script to deploy management groups for Azure global regions. This example uses the `managementGroups.bicep` template. ```powershell # For Azure global regions $inputObject = @{ DeploymentName = -join ('alz-MGDeployment-{0}' -f (Get-Date -Format 'yyyyMMddTHHMMssffffZ'))[0..63] Location = 'EastUS' TemplateFile = "infra-as-code/bicep/modules/managementGroups/managementGroups.bicep" TemplateParameterFile = 'infra-as-code/bicep/modules/managementGroups/parameters/managementGroups.parameters.all.json' } New-AzTenantDeployment @inputObject ``` -------------------------------- ### Sample Parameter File for Private DNS Zone Links Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/privateDnsZoneLinks/generateddocs/privateDnsZoneLinks.bicep.md This JSON file defines parameters for deploying Private DNS Zone Links. It includes values for spoke virtual network resource ID, private DNS zone resource IDs, and resolution policy. Ensure the 'value' fields are populated with appropriate resource IDs for your environment. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/privateDnsZoneLinks/privateDnsZoneLinks.json" }, "parameters": { "parSpokeVirtualNetworkResourceId": { "value": "" }, "parPrivateDnsZoneLinkResolutionPolicy": { "value": "Default" }, "parPrivateDnsZoneResourceId": { "value": "" }, "parResourceLockConfig": { "value": { "kind": "None", "notes": "This lock was created by the ALZ Bicep Private DNS Zone Links Module." } } } } ``` -------------------------------- ### Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/modules/spokeNetworking/generateddocs/spokeNetworking.bicep.md This JSON file defines parameters for deploying Bicep networking modules. It includes settings for location, BGP route propagation, DDoS protection, network address prefixes, and telemetry opt-out. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/modules/spokeNetworking/spokeNetworking.json" }, "parameters": { "parLocation": { "value": "[resourceGroup().location]" }, "parDisableBgpRoutePropagation": { "value": false }, "parDdosProtectionPlanId": { "value": "" }, "parGlobalResourceLock": { "value": { "kind": "None", "notes": "This lock was created by the ALZ Bicep Hub Networking Module." } }, "parSpokeNetworkAddressPrefix": { "value": "10.11.0.0/16" }, "parSpokeNetworkName": { "value": "vnet-spoke" }, "parSpokeNetworkLock": { "value": { "kind": "None", "notes": "This lock was created by the ALZ Bicep Spoke Networking Module." } }, "parDnsServerIps": { "value": [] }, "parNextHopIpAddress": { "value": "" }, "parSpokeToHubRouteTableName": { "value": "rtb-spoke-to-hub" }, "parSpokeRouteTableLock": { "value": { "kind": "None", "notes": "This lock was created by the ALZ Bicep Spoke Networking Module." } }, "parTags": { "value": {} }, "parTelemetryOptOut": { "value": false } } } ``` -------------------------------- ### Azure ALZ Bicep Parameter File Example Source: https://github.com/azure/alz-bicep/blob/main/infra-as-code/bicep/orchestration/subPlacementAll/generateddocs/subPlacementAll.bicep.md This JSON file defines parameters for an Azure Bicep deployment, specifying subscription IDs for various management groups and a telemetry opt-out setting. Ensure the schema and parameter values align with your deployment requirements. ```json { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "metadata": { "template": "infra-as-code/bicep/orchestration/subPlacementAll/subPlacementAll.json" }, "parameters": { "parTopLevelManagementGroupPrefix": { "value": "alz" }, "parTopLevelManagementGroupSuffix": { "value": "" }, "parIntRootMgSubs": { "value": [] }, "parPlatformMgSubs": { "value": [] }, "parPlatformManagementMgSubs": { "value": [] }, "parPlatformSecurityMgSubs": { "value": [] }, "parPlatformConnectivityMgSubs": { "value": [] }, "parPlatformMgChildrenSubs": { "value": {} }, "parPlatformIdentityMgSubs": { "value": [] }, "parLandingZonesMgSubs": { "value": [] }, "parLandingZonesCorpMgSubs": { "value": [] }, "parLandingZonesOnlineMgSubs": { "value": [] }, "parLandingZonesConfidentialCorpMgSubs": { "value": [] }, "parLandingZonesConfidentialOnlineMgSubs": { "value": [] }, "parLandingZoneMgChildrenSubs": { "value": {} }, "parDecommissionedMgSubs": { "value": [] }, "parSandboxMgSubs": { "value": [] }, "parTelemetryOptOut": { "value": false } } } ```