Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds IPAM (IP Address Management) modules and templates for Azure Virtual Network Manager to support blog post content. The implementation includes hierarchical IPAM pool management with automatic CIDR allocation and splitting between platform and application landing zones.
Changes:
- Added main AVNM module with IPAM support (avnm.bicep) that orchestrates network manager and IPAM pool deployment
- Implemented hierarchical IPAM pool modules for root and per-region allocation (ipam.bicep, ipamPerRegion.bicep)
- Added comprehensive landing zone type definitions with network, storage, key vault, and identity configurations
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| avnm/avnm.bicep | Main orchestration module that deploys Azure Virtual Network Manager and calls IPAM module with region configurations |
| avnm/ipam.bicep | Creates root IPAM pool and invokes per-region module for each specified region |
| avnm/ipamPerRegion.bicep | Implements CIDR subdivision logic and creates region, platform, and application IPAM pools |
| avnm/configuration/shared/lz.type.bicep | Comprehensive type definitions for landing zone resources including VNets, storage, Key Vault, and identity |
| avnm/configuration/platform/platformConnectivity-avnm.bicepparam | Example parameter file demonstrating IPAM configuration for Australia regions |
| avnm/configuration/.DS_Store | macOS system file that should not be in version control |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @description('Required. Display name of the Azureregion.') | ||
| displayName: string | ||
|
|
||
| @maxValue(100) | ||
| @minValue(0) | ||
| @description('Required. Factor to divide the Azureregion CIDR into platform and application landing zones, in percentage.') |
There was a problem hiding this comment.
There is a space missing between "Azure" and "region" in the description. It should be "Azure region" instead of "Azureregion".
| @description('Required. Display name of the Azureregion.') | |
| displayName: string | |
| @maxValue(100) | |
| @minValue(0) | |
| @description('Required. Factor to divide the Azureregion CIDR into platform and application landing zones, in percentage.') | |
| @description('Required. Display name of the Azure region.') | |
| displayName: string | |
| @maxValue(100) | |
| @minValue(0) | |
| @description('Required. Factor to divide the Azure region CIDR into platform and application landing zones, in percentage.') |
| @description('Required. Display name of the Azureregion.') | ||
| displayName: string | ||
|
|
||
| @maxValue(100) | ||
| @minValue(0) | ||
| @description('Required. Factor to divide the Azureregion CIDR into platform and application landing zones, in percentage.') |
There was a problem hiding this comment.
There is a space missing between "Azure" and "region" in the description. It should be "Azure region" instead of "Azureregion".
| @description('Required. Display name of the Azureregion.') | |
| displayName: string | |
| @maxValue(100) | |
| @minValue(0) | |
| @description('Required. Factor to divide the Azureregion CIDR into platform and application landing zones, in percentage.') | |
| @description('Required. Display name of the Azure region.') | |
| displayName: string | |
| @maxValue(100) | |
| @minValue(0) | |
| @description('Required. Factor to divide the Azure region CIDR into platform and application landing zones, in percentage.') |
| param platformAndApplicationSplitFactor int | ||
|
|
||
| // Calculate the total number of CIDR blocks available in the region | ||
| // Using the RegionCIDRsplitSize parameter to determine subdivision granularity |
There was a problem hiding this comment.
The comment refers to 'RegionCIDRsplitSize' parameter, but the actual parameter name is 'regionLzCidrSize'. This inconsistency between the comment and the code could cause confusion.
| // Using the RegionCIDRsplitSize parameter to determine subdivision granularity | |
| // Using the regionLzCidrSize parameter to determine subdivision granularity |
| var powersOfTwo = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] | ||
| var currentRegionCidrSplitSize = int(split(regionCidr, '/')[1]) | ||
| var subdivisionSize = regionLzCidrSize // Use the parameter directly for subdivision | ||
| var totalSubnetCount = powersOfTwo[subdivisionSize - currentRegionCidrSplitSize] |
There was a problem hiding this comment.
The powersOfTwo array only has 10 elements (indexes 0-9), but the code calculates the index as 'subdivisionSize - currentRegionCidrSplitSize'. With regionLzCidrSize (subdivisionSize) having a max value of 32 and currentRegionCidrSplitSize potentially being as small as 8 (from a /8 CIDR), the index could be as high as 24, which would cause an index out of bounds error. The array needs to be extended to handle all valid scenarios, or bounds checking should be added.
| var powersOfTwo = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] | |
| var currentRegionCidrSplitSize = int(split(regionCidr, '/')[1]) | |
| var subdivisionSize = regionLzCidrSize // Use the parameter directly for subdivision | |
| var totalSubnetCount = powersOfTwo[subdivisionSize - currentRegionCidrSplitSize] | |
| var currentRegionCidrSplitSize = int(split(regionCidr, '/')[1]) | |
| var subdivisionSize = regionLzCidrSize // Use the parameter directly for subdivision | |
| var subnetExponent = subdivisionSize - currentRegionCidrSplitSize | |
| var totalSubnetCount = int(pow(2, subnetExponent)) |
|
|
||
| @minValue(100) | ||
| @maxValue(4096) | ||
| @description('Required. Required. The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.') |
There was a problem hiding this comment.
The word "Required" appears twice in the description. This is redundant and should be removed.
| @description('Required. Required. The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.') | |
| @description('Required. The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.') |
| applicationCidrs: regionIpamPool[i].outputs.applicationCIDRs | ||
| applicationCidrsCount: regionIpamPool[i].outputs.applicationCIDRsCount | ||
| platformCidrs: regionIpamPool[i].outputs.platformCIDRs | ||
| platformCidrsCount: regionIpamPool[i].outputs.platformCIDRs |
There was a problem hiding this comment.
There is a typo in the output property 'platformCidrsCount'. It should reference 'platformCIDRsCount' (using the outputs property) instead of 'platformCIDRs'. This will cause the output to return an array instead of an integer count.
| platformCidrsCount: regionIpamPool[i].outputs.platformCIDRs | |
| platformCidrsCount: regionIpamPool[i].outputs.platformCIDRsCount |
| var platformSubnets = take(allSubnets, platformSubnetCount) | ||
| var applicationSubnets = skip(allSubnets, platformSubnetCount) | ||
|
|
||
| // Calculate the CIDRs for application landing zones |
There was a problem hiding this comment.
The comment on line 47 states "Calculate the CIDRs for application landing zones" but the variable being assigned is 'platformCIDRs'. This appears to be a copy-paste error. The comment should state "Calculate the CIDRs for platform landing zones".
| // Calculate the CIDRs for application landing zones | |
| // Calculate the CIDRs for platform landing zones |
| @description('Optional. Deploy the outbound and the inbound peering.') | ||
| remotePeeringEnabled: bool? | ||
|
|
||
| @description('Optional. The name of the VNET Peering resource in the remove Virtual Network. If not provided, default value will be peer-remoteVnetName-localVnetName.') |
There was a problem hiding this comment.
There's a typo in the word "remove" which should be "remote" in the context of remote Virtual Network peering.
| // Calculate the CIDRs for application landing zones | ||
| var platformCIDRs = platformSubnets | ||
|
|
||
| // Calculate the CIDRs for application landing zones |
There was a problem hiding this comment.
The variable assignment is redundant. The variable 'platformCIDRs' is simply assigned the value of 'platformSubnets' without any transformation. Similarly, 'applicationCIDRs' is just assigned 'applicationSubnets'. These intermediate variables don't add value and could be removed for clarity, or if there's intended future processing, a comment should explain the purpose.
| // Calculate the CIDRs for application landing zones | |
| var platformCIDRs = platformSubnets | |
| // Calculate the CIDRs for application landing zones | |
| // CIDR allocations for platform landing zones (alias for platformSubnets, kept for clarity/future processing) | |
| var platformCIDRs = platformSubnets | |
| // CIDR allocations for application landing zones (alias for applicationSubnets, kept for clarity/future processing) |
|
|
||
| @maxValue(32) | ||
| @minValue(8) | ||
| @description('CIDR size for the region IPAM pool. This is used to determine how many subnets can be created within the region CIDR.') |
There was a problem hiding this comment.
The 'regionLzCidrSize' parameter description states it's "CIDR size for the region IPAM pool" but this is not accurate. This parameter actually defines the CIDR size for each landing zone (LZ) subdivision within a region, not for the region IPAM pool itself. The description should clarify that this is the target CIDR prefix size for landing zone allocations within the region.
| @description('CIDR size for the region IPAM pool. This is used to determine how many subnets can be created within the region CIDR.') | |
| @description('Target CIDR prefix size for landing zone (LZ) allocations within the region IPAM pool. This value is used to determine how many LZ subnets can be created from the region CIDR.') |
Pull Request Template
Description
Add IPAM templates for blog post
Type of Change
Please select the type of change this pull request represents:
Checklist
Please review and check the following items before submitting this pull request:
Related Issues
Please list any related issues or pull requests that are addressed by this pull request.
Additional Notes
Please provide any additional notes or context regarding this pull request.