fix(networking): firewall policy region duplication, lock collisions, and secondary-location defaults#1161
Merged
oZakari merged 5 commits intoApr 29, 2026
Conversation
…name When parAzFirewallPoliciesName already ends with -<hubLocation>, the module previously appended the hub location a second time, producing names like alz-azfwpolicy-eastus-eastus. The name expression is now idempotent: the suffix is only appended if not already present.
10 tasks
…nd lock collisions - parAzFirewallNameSecondaryLocation default referenced parLocation instead of parSecondaryLocation, causing primary/secondary firewall names to collide on default values. - parAzFirewallPoliciesNameSecondaryLocation default had the same parLocation/parSecondaryLocation bug. - resVirtualNetworkLockSecondaryLocation default name referenced resHubVnet (primary) instead of resHubVnetSecondaryLocation, producing two locks with the same default name. - Disambiguate firewall policy lock default names: -primary-lock and -secondary-lock to harden against any future shared-name regressions.
ed817a7 to
02d970f
Compare
jtracey93
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a cluster of related bugs in the ALZ networking modules around firewall-policy naming and resource-lock default names. Supersedes #1159 (KiZach's lock-collision fix is included as a commit in this PR with original authorship preserved).
Bug 1 — vWAN: region duplicated in firewall policy name
vwanConnectivity.bicepauto-suffixes the hub location toparAzFirewallPoliciesName:If a customer's parameters file already contains the region in
parAzFirewallPoliciesName(e.g.alz-azfwpolicy-eastus), the location is appended a second time, producing names likealz-azfwpolicy-eastus-eastus.Fix: make the name expression idempotent for both
PerRegionandSharedGlobaldeployment styles — only append-${hub.parHubLocation}when the name does not already end with it. Backward-compatible.parAzFirewallPoliciesNamealz-azfwpolicyeastusalz-azfwpolicy-eastus(unchanged)alz-azfwpolicy-eastuseastusalz-azfwpolicy-eastus(wasalz-azfwpolicy-eastus-eastus)Bug 2 — vWAN: firewall policy lock collision (closes #1159)
Two problems with
resFirewallPoliciesLock/resFirewallPoliciesLockSharedGlobalinvwanConnectivity.bicep:resFirewallPoliciesLockis missing theparAzFirewallPolicyDeploymentStyle == 'PerRegion'guard, so inSharedGlobalmode it tries to scope to an empty array — producesInvalidTemplateerrors.PerRegionandSharedGloballocks share the same default name suffix (-lock), causing collisions when both code paths are evaluated.Fix (cherry-picked from @KiZach #1159):
PerRegionguard toresFirewallPoliciesLock.-perregion-lockand-sharedglobal-lock.Bug 3 —
hubNetworking-multiRegion.bicep: secondary-location defaults reference primary locationDefaults for the secondary-location firewall and firewall policy referenced
${parLocation}instead of${parSecondaryLocation}:When defaults were accepted, primary and secondary firewall / firewall-policy resources resolved to the same name and collided in ARM.
Bug 4 —
hubNetworking-multiRegion.bicep: secondary VNet lock referenced primary VNetresVirtualNetworkLockSecondaryLocationdefaulted to'${resHubVnet.name}-lock'instead of'${resHubVnetSecondaryLocation.name}-lock'. With default lock names, the primary and secondary VNet locks collided.Bug 5 —
hubNetworking-multiRegion.bicep: defensive lock-name disambiguationRenamed default firewall policy lock names to
-primary-lock/-secondary-lockto harden against future regressions of the kind in Bug 2.Files changed
infra-as-code/bicep/modules/vwanConnectivity/vwanConnectivity.bicepresFirewallPoliciesandresFirewallPoliciesSharedGlobal.parAzFirewallPoliciesName.resFirewallPoliciesLock;-perregion-lock/-sharedglobal-lockdefault names.infra-as-code/bicep/modules/hubNetworking/hubNetworking-multiRegion.bicepparAzFirewallNameSecondaryLocationandparAzFirewallPoliciesNameSecondaryLocationdefaults now useparSecondaryLocation.resVirtualNetworkLockSecondaryLocationdefault name now referencesresHubVnetSecondaryLocation.-primary-lock/-secondary-lock).Generated docs (
generateddocs/*.bicep.md) are produced by thepsdocs-mdtogitworkflow on merge.Credits