Agent skill

Permissions Auditor

by pnp in pnp/powershell

Audit PnP PowerShell permission attributes against the APIs a cmdlet actually calls and against its documentation.

MITAuto-check passedAgent Workflows

Install Permissions Auditor

skills CLI
$ npx skills add pnp/powershell --skill permissions-auditor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pnp/powershell permissions-auditor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pnp/powershell.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/permissions-auditor .claude/skills/permissions-auditor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
permissions-auditor
GitHub stars
906
Token cost
~2.1k tokens
SKILL.md length
950 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
MIT

At a glance

Audit PnP PowerShell permission attributes against the APIs a cmdlet actually calls and against its documentation.

  • Works in 3 steps: the attributes on the cmdlet class → the API calls in the method body → the Required Permissions block in…
  • Alters an API call
  • SKILL.md covers Why this matters more than it…, The attributes, Establishing what the code… and Cross-checking against the…, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Permissions Auditor is an agent skill from pnp/powershell. Audit PnP PowerShell permission attributes against the APIs a cmdlet actually calls and against its documentation. Use when a change adds or alters an API call or a RequiredApi attribute, when a user reports a 401/403 or a consent problem, or to sweep a folder under src/Commands/ for wrong or over-declared permissions.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows. It works with PowerShell and Microsoft 365. The licence is MIT.

When your agent uses it

  • Alters an API call
  • A RequiredApi attribute
  • A user reports a 401/403
  • A consent problem

Example prompts

  • “/permissions-auditor”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. the attributes on the cmdlet class
  2. the API calls in the method body
  3. the Required Permissions block in documentation/.md

What it can do on your machine

Read from SKILL.md and the folder at commit b2f7cea. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are csharp and markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Permissions Auditor loads about 2.1k tokens when it runs. Until then it costs about 85 tokens; SKILL.md has 950 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~85
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pnp/powershell at commit b2f7cea, republished under its MIT licence (© pnp). 950 words, ~2,087 tokens.

Download SKILL.mdSave it as .claude/skills/permissions-auditor/SKILL.md (or your agent's skills folder).
name
permissions-auditor
description
Audit PnP PowerShell permission attributes against the APIs a cmdlet actually calls and against its documentation. Use when a change adds or alters an API call or a RequiredApi* attribute, when a user reports a 401/403 or a consent problem, or to sweep a folder under src/Commands/ for wrong or over-declared permissions.

Playbook: permissions-auditor

Verify that a cmdlet's declared API permissions match the APIs it actually calls, and that its documentation says the same thing.

Why this matters more than it looks

Wrong permission metadata fails silently at runtime, in someone else's tenant. Nothing in the build catches it, no test covers it, and the user finds out through a 401 in an unattended script or by granting an app far more access than the cmdlet needs. It is the highest-value static check in this repository.

There are three independent statements of the same fact, and all three can be compared without running anything:

  1. the attributes on the cmdlet class
  2. the API calls in the method body
  3. the Required Permissions block in documentation/<Cmdlet>.md

Any disagreement between them is a finding.

Report findings in the session. Never open an issue or PR for one — see Human in the loop. A permission finding is security-adjacent; a maintainer decides whether it goes on a public tracker.

The attributes

Declared in src/Commands/Attributes/:

AttributeMeaning
RequiredApiDelegatedPermissionsNeeded when connected with delegated permissions.
RequiredApiApplicationPermissionsNeeded when connected with application permissions.
RequiredApiDelegatedOrApplicationPermissionsSame scope satisfies either flavour.
ApiNotAvailableUnderDelegatedPermissionsCmdlet cannot work delegated at all.
ApiNotAvailableUnderApplicationPermissionsCmdlet cannot work app-only at all.
ApiPermissionsNotRequiredNeeds nothing on the app registration. Informational.
ApiPermissionsDependOnResourceRequirement follows from the resource or invocation. Informational.

Semantics, from RequiredApiPermissionsBase:

  • Multiple attributes on one class are ORed. Any one of them being satisfied is enough.
  • Multiple scopes inside one attribute are ANDed. All of them are required.

Scope format is <resource>/<scope>, optionally https://-prefixed:

csharp
[RequiredApiDelegatedPermissions("sharepoint/AllSites.FullControl", "sharepoint/User.ReadWrite.All")]
[RequiredApiApplicationPermissions("sharepoint/Sites.FullControl.All", "sharepoint/User.ReadWrite.All")]
The failure mode to hunt for first

RequiredApiPermissionsBase parses each string with the regex (?:https://)?(?<resource>[^/]*?)/(?<scope>.*) and maps the resource through TokenHandler.DefineResourceTypeFromAudience. That method returns Unknown only for blank input; every other unrecognised audience falls through to _ => Enums.ResourceTypeName.SharePoint (src/Commands/Base/TokenHandler.cs), because vanity domains give SharePoint audiences no fixed shape.

So there are two distinct defects, and the common one is not what it looks like:

WrittenResult
"garph/Group.Read.All"Silently becomes a SharePoint scope Group.Read.All. The cmdlet declares a permission that does not exist on SharePoint, and its real Graph requirement is undeclared.
"Group.Read.All" (no /)Regex fails, null, scope dropped entirely — the cmdlet declares nothing.
"/Group.Read.All" (blank resource)Unknown → null → dropped.

Hunt for the first one primarily: a scope whose resource segment is not one of the audiences listed in DefineResourceTypeFromAudience, and any SharePoint-classified scope whose name looks like a Graph permission (*.Read.All, Group.*, User.*, Directory.*) on a cmdlet whose code calls Graph. Then check for null slots in PermissionScopes for the slashless cases.

Second failure mode: an attribute array with a single scope where the code demonstrably needs two (e.g. reads a user and writes a site), or the reverse — an AND list that over-declares and forces users to grant more than the cmdlet uses. Over-declaration is a real finding here, not a nitpick; least privilege is the point of the attribute.

Establishing what the code actually calls

Work out the resource from the base class, then confirm against the call sites.

Base classResource
PnPGraphCmdletMicrosoft Graph
PnPWebCmdlet, PnPSharePointCmdlet, PnPWebRetrievalsCmdlet<T>SharePoint (CSOM, site scope)
PnPSharePointOnlineAdminCmdletSharePoint (CSOM, tenant admin scope)
PnPAzureManagementApiCmdletAzure Management
PnPOfficeManagementApiCmdletOffice 365 Management
PnPGcsCmdletGraph consumer / cloud storage
PnPTasksCmdletPlanner / Tasks

Call sites to read:

  • GraphRequestHelper.Get / GetResultCollection / Post / PostHttpContent / Patch / Delete — the URL literal names the Graph endpoint. Look it up rather than guessing its scopes.
  • RequestHelper.* — same shape, non-Graph resource.
  • CSOM: Tenant.<Method>, CurrentWeb.<...>, ClientContext.Load + ExecuteQueryRetry().
  • A cmdlet may call more than one resource. Every one of them needs covering.

Do not infer a scope from the cmdlet name. Get- prefixed cmdlets routinely need write scopes because the underlying admin API is a POST, and several Set- cmdlets need only a read scope on a second resource they look something up in.

Use the Microsoft Learn MCP server to resolve a Graph endpoint to its documented least-privilege permission set. Do not answer from memory — Graph permission requirements change, and a confidently wrong scope here is worse than an admitted gap.

Show full SKILL.md (289 more words)Show less

Cross-checking against the documentation

documentation/<Verb-PnPNoun>.md states the same requirement in prose under ## SYNOPSIS:

markdown
## SYNOPSIS

**Required Permissions**

Access to SharePoint admin site

* SharePoint: AllSites.FullControl and User.ReadWrite.All when using delegated permissions
* SharePoint: Sites.FullControl.All and User.ReadWrite.All when using application permissions

Check that every scope in the attributes appears here with the right delegated/application flavour, and that nothing appears here that the attributes do not declare. ANDed scopes read as "X and Y"; ORed alternatives read as separate bullets. A cmdlet carrying ApiPermissionsNotRequired should not have a Required Permissions block at all.

Existing tooling to lean on

The repository already ships two cmdlets that read this metadata. Read their implementations to match their interpretation exactly rather than inventing your own:

  • Get-PnPCommandPermission (src/Commands/Base/GetCommandPermission.cs) — returns the declared and derived permissions for a cmdlet.
  • Test-PnPConnectionPermission — compares a token's claims against that metadata.

If your reading of an attribute disagrees with what these cmdlets do, they are the authority.

Procedure

  1. Scope the run: a folder under src/Commands/, a changed file set, or one cmdlet. State the scope in the report — a partial audit reported as complete is worse than no audit.
  2. For each cmdlet class, collect: base class, permission attributes, every API call site.
  3. Resolve each call site to its documented least-privilege permissions (Microsoft Learn MCP).
  4. Compare attributes ↔ code. Then attributes ↔ documentation synopsis.
  5. Discard anything you cannot substantiate. An unverified scope claim is worse than a gap.

Reporting

One row per finding, ordered by consequence:

FieldContent
CmdletVerb-PnPNoun and file.cs:line
Kindmissing / over-declared / wrong-flavour / silently-dropped / doc-mismatch
DeclaredWhat the attributes say
RequiredWhat the API actually needs, with the Learn URL you got it from
ConsequenceThe concrete failure — "app-only connection gets 403 on /users/{id}/drive"

Say plainly which cmdlets you checked and which you could not resolve. Confidence: high only when you have a Microsoft source for the scope; otherwise say what would settle it.

© pnp, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/permissions-auditor of pnp/powershell.

Open the folder on GitHubat commit b2f7cea

Compare with similar skills

Permissions Auditor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Permissions Auditor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Permissions Auditor this skillpnp/powershell906—~2.1kAutomated safety check: PassMIT
CLI Microsoft365 Scriptpnp/cli-microsoft365-mcp-server132—~3.3kAutomated safety check: PassMIT
Entra Agent Idmicrosoft/GitHub-Copilot-for-Azure2552 repos~4kAutomated safety check: PassMIT
Entra Agent Usergithub/awesome-copilot40k1 repos~2.3kAutomated safety check: PassMIT
Auditing Azure Active Directory Configurationmukul975/Anthropic-Cybersecurity-Skills34k—~3kAutomated safety check: PassApache-2.0
Outlook Nativetaracodlabs/aiden851—~816Automated safety check: PassApache-2.0

Similar skills

  • CLI Microsoft365 Script

    pnp/cli-microsoft365-mcp-server

    Write PowerShell scripts using CLI for Microsoft 365 commands to automate Microsoft 365 management tasks.

    132 GitHub stars~3.3k tokensUpdated 4 days ago
    Documents & OfficeAuto-check passed
  • Entra Agent Id

    microsoft/GitHub-Copilot-for-Azure

    Official

    Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant)…

    255 GitHub starsUsed in 2 repos~4k tokens
    Backend & APIsAuto-check passed
  • Entra Agent User

    github/awesome-copilot

    Official

    Create Agent Users in Microsoft Entra ID from Agent Identities, enabling AI agents to act as digital workers with user identity capabilities in Microsoft 365 and Azure environments.

    40k GitHub starsUsed in 1 repo~2.3k tokens
    Documents & OfficeAuto-check passed
  • Auditing Azure Active Directory Configuration

    mukul975/Anthropic-Cybersecurity-Skills

    Auditing Microsoft Entra ID (Azure Active Directory) configuration to identify risky authentication policies, overly permissive role assignments, stale accounts, conditional access gaps, and guest…

    34k GitHub stars~3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Outlook Native

    taracodlabs/aiden

    Outlook calendar + inbox via PowerShell COM or Microsoft Graph

    851 GitHub stars~816 tokensUpdated 26 days ago
    Productivity & AutomationAuto-check passed
  • Ms365 Tenant Manager

    borghei/Claude-Skills

    Microsoft 365 tenant administration for Global Administrators.

    886 GitHub stars~1.8k tokensUpdated 2 days ago
    Documents & OfficeAuto-check passed

More from pnp/powershell

All 9 skills in this repo
  • Cmdlet Scaffolder

    pnp/powershell

    Generate a new PnP PowerShell cmdlet modelled on an existing sibling - class with the right base class and permission attributes, the documentation page, and the changelog entry.

    906 GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • Dotnet Standards

    pnp/powershell

    C 12 / .NET 8 and PowerShell cmdlet design rules for this repository - naming, output and error channels, parameter validation, ShouldProcess, async, culture, cross-platform and ALC constraints.

    906 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check passed
  • Issue Triage

    pnp/powershell

    Take a PnP PowerShell GitHub issue, find the cmdlet that owns it, trace the code path, and decide whether the cause is in this repo or in PnP Framework, PnP Core SDK or the service.

    906 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • New Cmdlet

    pnp/powershell

    The conventions a PnP PowerShell cmdlet must satisfy - base class selection, permission attributes, PipeBinds, parameter validation, Graph and CSOM call patterns, and the documentation plus…

    906 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • API Surface Diff

    pnp/powershell

    Compare the public cmdlet surface of the current branch against dev - names, aliases, parameters, types, mandatory flags, parameter sets, output types, permissions - and classify each change as…

    906 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Code Review

    pnp/powershell

    Review changes to PnP PowerShell for the failure modes this repository actually ships - silently ignored input, unpaged Graph collections, the wrong base class, permission attributes that do not…

    906 GitHub stars~2.3k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Permissions Auditor

What does Permissions Auditor do?

Audit PnP PowerShell permission attributes against the APIs a cmdlet actually calls and against its documentation. Permissions Auditor is an agent skill from pnp/powershell. Audit PnP PowerShell permission attributes against the APIs a cmdlet actually calls and against its documentation.

When should I use Permissions Auditor?

Permissions Auditor fits situations like: alters an API call; A RequiredApi attribute; A user reports a 401/403; A consent problem.

How do I install Permissions Auditor in Claude Code?

Run `npx skills add pnp/powershell --skill permissions-auditor -a claude-code`. Or copy the skill folder (.agents/skills/permissions-auditor in pnp/powershell) into .claude/skills/permissions-auditor in your project. Claude Code loads it when a task matches its description.

How do I install Permissions Auditor in Codex?

Run `npx skills add pnp/powershell --skill permissions-auditor -a codex`. Or copy the skill folder (.agents/skills/permissions-auditor in pnp/powershell) into .agents/skills/permissions-auditor in your project. Codex loads it when a task matches its description.

Can I use Permissions Auditor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pnp/powershell --skill permissions-auditor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/permissions-auditor, .gemini/skills/permissions-auditor, .github/skills/permissions-auditor and .opencode/skills/permissions-auditor in your project.

What does Permissions Auditor need to run?

SKILL.md names no scripts, command-line tools or credentials: Permissions Auditor is instructions for the agent only.

Does Permissions Auditor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Permissions Auditor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Permissions Auditor use?

Permissions Auditor is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Permissions Auditor use?

About 2.1k tokens (SKILL.md is roughly 8.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Permissions Auditor?

Skills that share tags, products or a category with Permissions Auditor: CLI Microsoft365 Script (pnp/cli-microsoft365-mcp-server, 132 stars), Entra Agent Id (microsoft/GitHub-Copilot-for-Azure, 255 stars), Entra Agent User (github/awesome-copilot, 40k stars) and Auditing Azure Active Directory Configuration (mukul975/Anthropic-Cybersecurity-Skills, 34k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Permissions Auditor?

pnp (a GitHub organization) maintains it in pnp/powershell, which has 906 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 8, 2026.

Source: pnp/powershell on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.