Grant AKS managed identity Network Contributor on subnet route table and NAT gateway#320
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the AKS private-networking install/upgrade flow to avoid LinkedAuthorizationFailed errors when the target existing subnet references additional network resources (route table and/or NAT gateway), by extending RBAC grants/cleanup for the cluster managed identity.
Changes:
- Capture existing subnet’s linked route table and NAT gateway resource IDs during cluster creation.
- Grant the AKS cluster user-assigned managed identity
Network Contributoron the subnet’s route table and NAT gateway (when present). - Remove RBAC role assignments for the cluster principal on the subnet’s route table and NAT gateway during cluster deletion.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hansenms
approved these changes
May 19, 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.
When private networking is enabled with a pre-existing subnet that has a user-defined route table attached (e.g., for routing default egress through a peered hub VNet), installation/upgrade could later fail with a
LinkedAuthorizationFailederror from the AKS cloud-controller-manager:Azure Resource Manager performs a linked authorization check whenever a write occurs on a subnet: the calling principal must hold
join/actionon every resource the subnet references (NSG, route table, NAT gateway, etc.). The installer was already granting the AKS cluster's user-assigned managed identityNetwork Contributoron the VNet, the subnet's NSG, and the outbound public IP, but not on the route table or NAT gateway.