agentleFS
Microsoft AzureKnown publisherAzure/vscode-aks-tools/skills/kickstart-pim-activation/SKILL.md

kickstart-pim-activation

Skill65 starsChanged 3 months agoMITView on GitHub

PIM (Privileged Identity Management) eligible role activation. Checks for activatable roles via az rest and guides the user through portal-based activation when they hit 403 errors on role assignments.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When the user gets a 403 on az role assignment create or az aks update --attach-acr (meaning they lack …

    line 9
  2. Very specific:

    If canCreate === true: skip PIM activation entirely.

    line 39
  3. Very specific:

    If canCreate === false and eligiblePimRoles.length > 0: render markdown in the chat, then proceed to Step 2 for activation guidance.

    line 40
  4. Very specific:

    If canCreate === false and eligiblePimRoles.length === 0 (or eligiblePimRoles is missing): render markdown and proceed to Step 3 (admin …

    line 41
  5. Very specific:

    If error is set: render the error and fall back to the manual az rest query below.

    line 42
  6. Very specific:

    Use vscode_askQuestions to ask the user to confirm activation.

    line 79
  7. Distinctive:

    Ask the user to confirm once their admin has run it

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PIM Eligible Role Activation

When the user gets a 403 on az role assignment create or az aks update --attach-acr (meaning they lack Microsoft.Authorization/roleAssignments/write), check whether they have PIM-eligible roles they can self-activate before falling back to admin hand-off.

Step 1 — Run the built-in permissions check (preferred)

Invoke the bundled VS Code command via vscode/runCommand. It performs the active-permissions check and the PIM eligibility lookup in one call, and returns a self-contained markdown report you can render directly in the chat.

Command ID: aks.checkRoleAssignmentPermissions

Args:

{
  "subscriptionId": "<sub>",
  "resourceGroup": "<rg>"
}

Returns:

{
  cancelled: boolean,
  canCreate?: boolean,             // true if the user can already create role assignments
  scope?: { subscriptionId, subscriptionName, resourceGroup, resourceGroupScopeId },
  verdict?: { canCreate, grantingActions, strippedByNotActions },
  eligiblePimRoles?: Array<{ roleName, scopeId, scopeDisplayName?, grantingAction? }>,
  markdown: string                 // full report — render this verbatim in chat
}

How to use the result:

  • If canCreate === true: skip PIM activation entirely; retry the original az role assignment create / az aks update --attach-acr.
  • If canCreate === false and eligiblePimRoles.length > 0: render markdown in the chat, then proceed to Step 2 for activation guidance.
  • If canCreate === false and eligiblePimRoles.length === 0 (or eligiblePimRoles is missing): render markdown and proceed to Step 3 (admin hand-off).
  • If error is set: render the error and fall back to the manual az rest query below.

Manual fallback (only if the command is unavailable):

az rest --method GET \
  --uri "https://management.azure.com/subscriptions/<sub>/providers/Microsoft.Authorization/roleEligibilityScheduleInstances?\$filter=asTarget()&api-version=2020-10-01" \
  --query "value[].{role:properties.roleDefinition.displayName, scope:properties.scope}" \
  -o table

Step 2 — If eligible roles found

Show the user which roles they can activate and link them to the resource's IAM page in the portal. Construct the link using the resource type that failed:

For AKS cluster resources:

https://portal.azure.com/#@<tenant>/resource/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ContainerService/managedClusters/<cluster>/users

For ACR resources:

https://portal.azure.com/#@<tenant>/resource/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ContainerRegistry/registries/<acr>/users

Then give these instructions:

You have PIM-eligible roles you can activate. Open the link below to activate a role that grants the needed permission:

<portal link>

  1. Click "View my access"
  2. Select the "Eligible assignments" tab
  3. Find a role that grants the needed permission (e.g. Owner, Contributor, or User Access Administrator) and click "Activate"
  4. Fill in the justification and duration, then confirm
  5. Come back here and let me know once it's activated

Use vscode_askQuestions to ask the user to confirm activation. After they confirm, wait 30 seconds for propagation, then validate by retrying the command that originally failed. If it still fails, suggest waiting another minute and retrying once more.

Step 3 — If no eligible roles found

Fall back to admin hand-off:

  • Print the exact az role assignment create command the admin needs to run
  • Ask the user to confirm once their admin has run it
  • Validate by retrying the failed command or polling az role assignment list

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.