azure-containerapps-attach-user-mi

derived azure emits CanAttachIdentity

match

A conjunctive graph pattern. Variables (?x) bind node ids; every clause must hold.

{'principal': None} CanPassIdentity {'userMI': None}

where

?principal has EFFECTIVE Microsoft.ManagedIdentity/userAssignedIdentities/assign/action on ?userMI ?principal has EFFECTIVE Microsoft.App/containerApps/write (or Microsoft.App/jobs/write) on the target app/job (existing or new)

emit

source typeIdentity
target typeCompute
source<principal>
target<containerApp or job (existing or new)>
permissionsMicrosoft.ManagedIdentity/userAssignedIdentities/assign/action Microsoft.App/containerApps/write
conditionsrole_compatibility

Narrative

{principal.name} can attach user-assigned MI {userMI.name} to Container App {target.name} (assign/action + containerApps/write).

Raw rule rules/derived/azure/containerapps.yaml

id: azure-containerapps-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.App/containerApps/write (or Microsoft.App/jobs/write) on the target
  app/job (existing or new)
emit:
  source_type: Identity
  target_type: Compute
  source: <principal>
  target: <containerApp or job (existing or new)>
  permissions:
  - Microsoft.ManagedIdentity/userAssignedIdentities/assign/action
  - Microsoft.App/containerApps/write
  conditions:
  - role_compatibility
  false_positive_note: 'BOTH permissions are required: assign/action on the MI AND containerApps/jobs
    write on the target. Neither alone attaches the MI. Honor the assign/action resource scope.'
  narrative: '{principal.name} can attach user-assigned MI {userMI.name} to Container App {target.name}
    (assign/action + containerApps/write).'
move · open · esc close