azure-aci-attach-user-mi
match
A conjunctive graph pattern. Variables (?x) bind node ids; every clause must hold.
where
?principal has EFFECTIVE Microsoft.
ManagedIdentity/userAssignedIdentities/assign/action on ?userMI
?principal has EFFECTIVE Microsoft.ContainerInstance/containerGroups/write on the target group (existing or new)
emit
| source type | Identity |
|---|---|
| target type | Compute |
| source | <principal> |
| target | <containerGroup (existing or new)> |
| permissions | Microsoft.ManagedIdentity/userAssignedIdentities/assign/action Microsoft.ContainerInstance/containerGroups/write |
| conditions | role_compatibility |
Narrative
{principal.name} can attach user-assigned MI {userMI.name} to container group {target.name} (assign/action + containerGroups/write).
Raw rule rules/derived/azure/aci.yaml
id: azure-aci-attach-user-mi
emits: CanAttachIdentity
match:
- - principal: null
- CanPassIdentity
- userMI: null
where:
- ?principal has EFFECTIVE Microsoft.ManagedIdentity/userAssignedIdentities/assign/action on ?userMI
- ?principal has EFFECTIVE Microsoft.ContainerInstance/containerGroups/write on the target group (existing
or new)
emit:
source_type: Identity
target_type: Compute
source: <principal>
target: <containerGroup (existing or new)>
permissions:
- Microsoft.ManagedIdentity/userAssignedIdentities/assign/action
- Microsoft.ContainerInstance/containerGroups/write
conditions:
- role_compatibility
passable_identity: <?userMI - the user-assigned MI this principal can attach to the group>
evidence:
passable_identity: ?userMI
note: Records which MI the CanAttachIdentity edge can attach so downstream derived rules (azure-aci-create-workload-as)
can recover ?userMI and evaluate its privilege_level.
false_positive_note: 'BOTH permissions are required: assign/action on the MI AND containerGroups/write
on the group. Neither alone attaches the MI. Honor the assign/action resource scope. The CanAttachIdentity
edge targets the Compute group (schema target = Compute); the specific attachable MI is carried in
evidence.passable_identity so the create-workload-as escalation guard can bind it.'
narrative: '{principal.name} can attach user-assigned MI {userMI.name} to container group {target.name}
(assign/action + containerGroups/write).'