Skip to content

feat(azure): user-assigned managed identities (Microsoft.ManagedIdentity) - #910

Merged
NitinKumar004 merged 1 commit into
developmentfrom
feat/azure-managed-identities
Aug 31, 2026
Merged

feat(azure): user-assigned managed identities (Microsoft.ManagedIdentity)#910
NitinKumar004 merged 1 commit into
developmentfrom
feat/azure-managed-identities

Conversation

@NitinKumar004

Copy link
Copy Markdown
Collaborator

What

Adds Azure user-assigned managed identities (Microsoft.ManagedIdentity/userAssignedIdentities).

  • New server/azure/managedidentity/ ARM handler: PUT (create/update), GET, DELETE, ListByResourceGroup, ListBySubscription, plus PATCH. All synchronous201 on create, 200 on update/get, 200/204 on delete. The armmsi UserAssignedIdentitiesClient is not a Begin* poller, so there is no LRO plumbing and no operationStatuses responder to wire (avoids the poller-hang trap entirely).
  • New provider Mock providers/azure/managedidentity: mints clientId/principalId/tenantId once at create time and persists them. They are never regenerated on a read — clients capture principalId to grant the identity RBAC role assignments, so a per-read regeneration would silently break those assignments. tenantId is shared across all identities in the estate (matches real Azure).
  • Registered on the Azure server and wired via DriversFrom; new provider field is picked up automatically by SnapshotServices (identity-preserving persistence) and machine-guarded by persist/completeness_test.go.
  • Added to the PurgeResourceGroup cascade so a resource-group delete tears down its identities.

ARG collision resolution

microsoft.managedidentity/userassignedidentities was already mapped in Resource Graph — but to iam/User, i.e. Azure AD users (walkIAMIAM.ListUsers), an unrelated concept. Adding the real managed-identity type would have been a duplicate map key (compile error) and a semantic collision.

Resolution (confirmed the old entry served no real purpose — AAD users are not ARM/Resource Graph resources, and no test depended on the mapping):

  • Forward map (resourcegraph/kql.go): microsoft.managedidentity/userassignedidentitiesiam/UserAssignedIdentity (was iam/User) — now resolves to the real managed-identity resource, discovered through a new inventory adapter.
  • Reverse map (resourcegraph/handler.go): dropped the stale iam/User → managed-identity entry (AAD users now fall back to their own iam/user label, non-colliding) and added iam/UserAssignedIdentity → the ARM type.
  • ARG triple: new portable TypeUserAssignedIdentity const + a GenericResources discovery adapter (managedIdentityDiscovery, mirroring azureMLDiscovery) so identities surface in Resource Graph / az resource list.

Architecture fit

Follows the established Azure-only patterns: interface-in-server-package backend (like aksserver.Backend), provider Mock holding a memstore.Store behind snapshot.Snapshottable, and the generic Extra/GenericResources inventory projection rather than widening any cross-cloud driver. No data plane (managed identities have none — matches the TDE boundary).

Test

Real-SDK e2e with armmsi.UserAssignedIdentitiesClient against a live httptest server: create → Get round-trips a stable principalId/clientId/tenantId, a second Get returns the same ids, update preserves them, ListByResourceGroup/ListBySubscription scoping, and delete → 404. Plus provider unit tests (id stability, shared tenant, purge cascade, snapshot round-trip) and a Resource Graph mapping test locking in the collision resolution. docs/coverage/ regenerated.

Refs #611.

…ity)

Add Microsoft.ManagedIdentity/userAssignedIdentities: a new managedidentity
handler package (PUT/GET/DELETE/ListByRG/ListBySub, sync-200/201, no LRO) backed
by a new provider Mock that mints stable clientId/principalId/tenantId once and
never regenerates them, with snapshot persistence and RG-delete cascade.

Resolve the ARG collision: microsoft.managedidentity/userassignedidentities was
mapped to iam/User (AAD users, an unrelated concept). Repoint it to the real
managed-identity resource (iam/UserAssignedIdentity), discovered via a new
inventory adapter; AAD users keep their own label.
@NitinKumar004
NitinKumar004 merged commit 07bea10 into development Aug 31, 2026
18 checks passed
@NitinKumar004
NitinKumar004 deleted the feat/azure-managed-identities branch August 31, 2026 04:44
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