azure-batch-attach-pool-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.Batch/batchAccounts/pools/write on the target pool (existing or new)
emit
| source type | Identity |
|---|---|
| target type | Compute |
| source | <principal> |
| target | <batch pool (existing or new)> |
| permissions | Microsoft.ManagedIdentity/userAssignedIdentities/assign/action Microsoft.Batch/batchAccounts/pools/write |
| conditions | role_compatibility service_state |
Narrative
{principal.name} can attach user-assigned MI {userMI.name} to pool {target.name} (assign/action + pools/write).
Raw rule rules/derived/azure/batch.yaml
id: azure-batch-attach-pool-mi
emits: CanAttachIdentity
match:
- - principal: null
- CanPassIdentity
- userMI: null
where:
- ?principal has EFFECTIVE Microsoft.ManagedIdentity/userAssignedIdentities/assign/action on ?userMI
- ?principal has EFFECTIVE Microsoft.Batch/batchAccounts/pools/write on the target pool (existing or new)
emit:
source_type: Identity
target_type: Compute
source: <principal>
target: <batch pool (existing or new)>
permissions:
- Microsoft.ManagedIdentity/userAssignedIdentities/assign/action
- Microsoft.Batch/batchAccounts/pools/write
conditions:
- role_compatibility
- service_state
false_positive_note: 'BOTH permissions are required: assign/action on the MI AND pools/write on the
pool. Neither alone attaches the MI. Honor the assign/action resource scope. In-place attach needs
zero active nodes to propagate.'
narrative: '{principal.name} can attach user-assigned MI {userMI.name} to pool {target.name} (assign/action
+ pools/write).'