Skip to content

fix(azure): repair malformed ARM ids so catalog lists are not collapsed - #18

Merged
rchildress87 merged 1 commit into
mainfrom
fix/azure-network-malformed-ids
Sep 27, 2026
Merged

rchildress87 merged 1 commit into
mainfrom
fix/azure-network-malformed-ids

Conversation

@rchildress87

Copy link
Copy Markdown
Contributor

Problem

Azure returns some list results with empty id segments. Firewall FQDN tags and ExpressRoute service providers return /subscriptions//resourceGroups//providers/Microsoft.Network/<type>/ for every item (confirmed with az rest). Every item in each list shared one NativeID. Each scan wrote the items as successive versions of one resource, so only the last item stayed current. A fresh database reported 233 changed (23 + 210).

Fix

azTrackedRows now passes every id through repairARMID. When an id has an empty segment, the helper rebuilds it as /subscriptions/<sub>/providers/<ns>/<type>/<name>, using the item's name. Well-formed ids are unchanged.

BGP service communities had the same empty scope segments but kept their names, so they were unique. Their ids are now canonical too. An existing database sees those 348 rows replaced once.

Test plan

  • TestRepairARMID covers well-formed ids, a missing name, empty scope segments, and the cases with nothing to rebuild from.
  • TestAzTrackedRows_MalformedIDsStayDistinct uses the live FQDN tag shape.
  • go test ./internal/providers/azure/ passes. golangci-lint reports 0 issues.
  • Live test on two subscriptions: two scans into a fresh --db report 0 changed. There are no duplicate natural keys and no id with an empty segment.

🤖 Generated with Claude Code

Azure returns some list results with empty id segments. Firewall FQDN
tags and ExpressRoute service providers answer with
"/subscriptions//resourceGroups//providers/Microsoft.Network/<type>/" for
every item, so all 24 tags and all 211 providers shared one NativeID. Each
scan wrote them as successive versions of one resource: a fresh database
reported 233 changed rows and kept only the last item current.

azTrackedRows now passes every id through repairARMID, which rebuilds
"/subscriptions/<sub>/providers/<ns>/<type>/<name>" when the id has an
empty segment. Well-formed ids are unchanged. BGP service communities had
the same empty scope segments but kept their names; their ids are now
canonical too, so an existing database sees those 348 rows replaced once.

Verified live on two subscriptions: two scans into a fresh --db report
0 changed, no duplicate natural keys, and no id with an empty segment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rchildress87
rchildress87 merged commit f75bd57 into main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant