CLI Microsoft365 Script
pnp/cli-microsoft365-mcp-server
Write PowerShell scripts using CLI for Microsoft 365 commands to automate Microsoft 365 management tasks.
Audit PnP PowerShell permission attributes against the APIs a cmdlet actually calls and against its documentation.
$ npx skills add pnp/powershell --skill permissions-auditor -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install pnp/powershell permissions-auditor --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ 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-srcUse ~/.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/
Install the "permissions-auditor" agent skill from https://github.com/pnp/powershell/tree/dev/.agents/skills/permissions-auditor into .claude/skills/permissions-auditor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "permissions-auditor", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/pnp/powershell/tree/dev/.agents/skills/permissions-auditorType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add pnp/powershell --skill permissions-auditor -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install pnp/powershell permissions-auditor --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pnp/powershell.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/permissions-auditor .agents/skills/permissions-auditor && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "permissions-auditor" agent skill from https://github.com/pnp/powershell/tree/dev/.agents/skills/permissions-auditor into .agents/skills/permissions-auditor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "permissions-auditor", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pnp/powershell --skill permissions-auditor -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install pnp/powershell permissions-auditor --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pnp/powershell.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/permissions-auditor .cursor/skills/permissions-auditor && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "permissions-auditor" agent skill from https://github.com/pnp/powershell/tree/dev/.agents/skills/permissions-auditor into .cursor/skills/permissions-auditor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "permissions-auditor", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/pnp/powershell.git --path .agents/skills/permissions-auditor--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add pnp/powershell --skill permissions-auditor -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install pnp/powershell permissions-auditor --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pnp/powershell.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/permissions-auditor .gemini/skills/permissions-auditor && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "permissions-auditor" agent skill from https://github.com/pnp/powershell/tree/dev/.agents/skills/permissions-auditor into .gemini/skills/permissions-auditor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "permissions-auditor", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install pnp/powershell permissions-auditorInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add pnp/powershell --skill permissions-auditor -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/pnp/powershell.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/permissions-auditor .github/skills/permissions-auditor && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "permissions-auditor" agent skill from https://github.com/pnp/powershell/tree/dev/.agents/skills/permissions-auditor into .github/skills/permissions-auditor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "permissions-auditor", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pnp/powershell --skill permissions-auditor -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install pnp/powershell permissions-auditor --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pnp/powershell.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/permissions-auditor .opencode/skills/permissions-auditor && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "permissions-auditor" agent skill from https://github.com/pnp/powershell/tree/dev/.agents/skills/permissions-auditor into .opencode/skills/permissions-auditor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "permissions-auditor", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
permissions-auditorAudit 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. 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.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit b2f7cea. It shows what the files ask for, not the result of running them.
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.
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.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
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.
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.
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.
The full file from pnp/powershell at commit b2f7cea, republished under its MIT licence (© pnp). 950 words, ~2,087 tokens.
.claude/skills/permissions-auditor/SKILL.md (or your agent's skills folder).Verify that a cmdlet's declared API permissions match the APIs it actually calls, and that its documentation says the same thing.
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:
documentation/<Cmdlet>.mdAny 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.
Declared in src/Commands/Attributes/:
| Attribute | Meaning |
|---|---|
RequiredApiDelegatedPermissions | Needed when connected with delegated permissions. |
RequiredApiApplicationPermissions | Needed when connected with application permissions. |
RequiredApiDelegatedOrApplicationPermissions | Same scope satisfies either flavour. |
ApiNotAvailableUnderDelegatedPermissions | Cmdlet cannot work delegated at all. |
ApiNotAvailableUnderApplicationPermissions | Cmdlet cannot work app-only at all. |
ApiPermissionsNotRequired | Needs nothing on the app registration. Informational. |
ApiPermissionsDependOnResource | Requirement follows from the resource or invocation. Informational. |
Semantics, from RequiredApiPermissionsBase:
Scope format is <resource>/<scope>, optionally https://-prefixed:
[RequiredApiDelegatedPermissions("sharepoint/AllSites.FullControl", "sharepoint/User.ReadWrite.All")]
[RequiredApiApplicationPermissions("sharepoint/Sites.FullControl.All", "sharepoint/User.ReadWrite.All")]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:
| Written | Result |
|---|---|
"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.
Work out the resource from the base class, then confirm against the call sites.
| Base class | Resource |
|---|---|
PnPGraphCmdlet | Microsoft Graph |
PnPWebCmdlet, PnPSharePointCmdlet, PnPWebRetrievalsCmdlet<T> | SharePoint (CSOM, site scope) |
PnPSharePointOnlineAdminCmdlet | SharePoint (CSOM, tenant admin scope) |
PnPAzureManagementApiCmdlet | Azure Management |
PnPOfficeManagementApiCmdlet | Office 365 Management |
PnPGcsCmdlet | Graph consumer / cloud storage |
PnPTasksCmdlet | Planner / 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.Tenant.<Method>, CurrentWeb.<...>, ClientContext.Load + ExecuteQueryRetry().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.
documentation/<Verb-PnPNoun>.md states the same requirement in prose under ## SYNOPSIS:
## 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 permissionsCheck 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.
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.
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.One row per finding, ordered by consequence:
| Field | Content |
|---|---|
| Cmdlet | Verb-PnPNoun and file.cs:line |
| Kind | missing / over-declared / wrong-flavour / silently-dropped / doc-mismatch |
| Declared | What the attributes say |
| Required | What the API actually needs, with the Learn URL you got it from |
| Consequence | The 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
Just SKILL.md in .agents/skills/permissions-auditor of pnp/powershell.
Open the folder on GitHubat commit b2f7cea
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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Permissions Auditor this skillpnp/powershell | 906 | — | ~2.1k | Automated safety check: Pass | MIT | |
| CLI Microsoft365 Scriptpnp/cli-microsoft365-mcp-server | 132 | — | ~3.3k | Automated safety check: Pass | MIT | |
| Entra Agent Idmicrosoft/GitHub-Copilot-for-Azure | 255 | 2 repos | ~4k | Automated safety check: Pass | MIT | |
| Entra Agent Usergithub/awesome-copilot | 40k | 1 repos | ~2.3k | Automated safety check: Pass | MIT | |
| Auditing Azure Active Directory Configurationmukul975/Anthropic-Cybersecurity-Skills | 34k | — | ~3k | Automated safety check: Pass | Apache-2.0 | |
| Outlook Nativetaracodlabs/aiden | 851 | — | ~816 | Automated safety check: Pass | Apache-2.0 |
pnp/cli-microsoft365-mcp-server
Write PowerShell scripts using CLI for Microsoft 365 commands to automate Microsoft 365 management tasks.
microsoft/GitHub-Copilot-for-Azure
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)…
github/awesome-copilot
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.
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…
taracodlabs/aiden
Outlook calendar + inbox via PowerShell COM or Microsoft Graph
borghei/Claude-Skills
Microsoft 365 tenant administration for Global Administrators.
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.
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.
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.
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…
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…
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…
Works with
Categories
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.
Permissions Auditor fits situations like: alters an API call; A RequiredApi attribute; A user reports a 401/403; A consent problem.
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.
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.
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.
SKILL.md names no scripts, command-line tools or credentials: Permissions Auditor is instructions for the agent only.
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.
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.
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.
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.
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.
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.