azure-aml-attach-mi-to-compute

Attach a user-assigned MI to an AML compute cluster/instance - future jobs run as the new 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.MachineLearningServices/workspaces/computes/write on the target compute

emit

source typeIdentity
target typeCompute
source<principal>
target<AML compute cluster or compute instance>
permissionsMicrosoft.ManagedIdentity/userAssignedIdentities/assign/action Microsoft.MachineLearningServices/workspaces/computes/write
conditionsrole_compatibility service_state
state logicACTIVE for the attach capability itself; downstream CanExecuteAs via can-execute-as linchpin requires a run path (job submit or existing node startup) and that the new MI out-privileges the caller. Emit CONDITIONAL(service_state) when the cluster has active nodes that will not pick up the new MI without a scale cycle.

Narrative

{principal.name} can attach user-assigned MI {userMI.name} to compute {target.name} (assign/action + computes/write); future training jobs on this compute will execute as {userMI.name}.

Raw rule rules/derived/azure/machinelearning.yaml

id: azure-aml-attach-mi-to-compute
emits: CanAttachIdentity
description: "Attach a user-assigned MI to an AML compute cluster/instance \u2014 future jobs run as the\
  \ new MI."
match:
- - principal: null
  - CanPassIdentity
  - userMI: null
where:
- ?principal has EFFECTIVE Microsoft.ManagedIdentity/userAssignedIdentities/assign/action on ?userMI
- ?principal has EFFECTIVE Microsoft.MachineLearningServices/workspaces/computes/write on the target compute
emit:
  source_type: Identity
  target_type: Compute
  source: <principal>
  target: <AML compute cluster or compute instance>
  permissions:
  - Microsoft.ManagedIdentity/userAssignedIdentities/assign/action
  - Microsoft.MachineLearningServices/workspaces/computes/write
  conditions:
  - role_compatibility
  - service_state
  state_logic: ACTIVE for the attach capability itself; downstream CanExecuteAs via can-execute-as linchpin
    requires a run path (job submit or existing node startup) and that the new MI out-privileges the caller.
    Emit CONDITIONAL(service_state) when the cluster has active nodes that will not pick up the new MI
    without a scale cycle.
  false_positive_note: "BOTH permissions are required: assign/action on the specific MI AND computes/write\
    \ on the specific compute. Neither alone attaches the MI. Honor the assign/action resource scope \u2014\
    \ a narrow scope to a specific MI resource prevents free choice. Running nodes do not pick up the\
    \ new MI without a restart/scale cycle."
  narrative: '{principal.name} can attach user-assigned MI {userMI.name} to compute {target.name} (assign/action
    + computes/write); future training jobs on this compute will execute as {userMI.name}.'
move · open · esc close