
Skill
kickstart-pim-activation
activate Azure PIM privileged roles
Description
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.
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 originalaz role assignment create/az aks update --attach-acr. - If
canCreate === falseandeligiblePimRoles.length > 0: rendermarkdownin the chat, then proceed to Step 2 for activation guidance. - If
canCreate === falseandeligiblePimRoles.length === 0(oreligiblePimRolesis missing): rendermarkdownand proceed to Step 3 (admin hand-off). - If
erroris set: render the error and fall back to the manualaz restquery 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>
- Click "View my access"
- Select the "Eligible assignments" tab
- Find a role that grants the needed permission (e.g. Owner, Contributor, or User Access Administrator) and click "Activate"
- Fill in the justification and duration, then confirm
- 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 createcommand 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
More skills from the vscode-aks-tools repository
View all 19 skillskickstart-acr-integration
integrate Azure Container Registry with AKS
Jul 12AzureContainersDeploymentkickstart-bicep-authoring
author idiomatic Azure Bicep templates
Jul 12AzureBicepDeploymentInfrastructure as Codekickstart-cluster-status
monitor AKS cluster provisioning status
Jul 12AzureDeploymentKubernetesMonitoringkickstart-collaborator-voice
define agent voice and interaction patterns
Jul 12AgentsBrandingCommunicationskickstart-configure-infra
configure Azure infrastructure for AKS clusters
Jul 12AzureDeploymentInfrastructureKuberneteskickstart-deploy
deploy applications with Azure CLI and kubectl
Jul 12AzureCLIDeploymentKubernetes
More from Azure (Microsoft)
View publisherazure-arg-external-evaluation-policy-author
author and test Azure Resource Graph policies
azure-policy
Jul 12AzureComplianceGovernancePolicyazure-blueprints-migration
migrate Azure Blueprints to Template Specs
azure-blueprints
Jul 12AzureDeploymentInfrastructure as CodeMigrationapiview-feedback-resolution
resolve APIView feedback on Azure SDKs
azure-sdk-tools
Jul 12API DevelopmentAzureCode ReviewDocumentationazsdk-common-live-and-recorded-tests
deploy resources and run Azure SDK tests
azure-sdk-tools
Jul 12AzureDeploymentSDKTestingazsdk-common-prepare-release-plan
manage Azure SDK release plan work items
azure-sdk-tools
Jul 12AzureGitHubProject ManagementSDKazsdk-common-sdk-release
release Azure SDK packages
azure-sdk-tools
Jul 12AzureCI/CDDeploymentSDK