plugins/power-pages/skills/manage-firewall/SKILL.md
Inspects and configures the web application firewall (WAF) in front of a Power Pages production site. Lists the current state, recommends enabling protection when it is off, and walks the user through adding, updating, or removing custom rules — IP blocks, country blocks, path blocks, and rate limits. Use when the user wants to turn on WAF, block traffic by IP or country, rate-limit login or signup pages, protect pages from brute-force attempts, restrict access to specific paths, review the current firewall configuration, or asks "is my site protected against bots / common web attacks?" — even if they say "add rate limit" or "protect login page" without mentioning "firewall" or "WAF".
npx skillsauth add microsoft/power-platform-skills manage-firewallInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Plugin check: Run
node "${PLUGIN_ROOT}/scripts/check-version.js"— if it outputs a message, show it to the user before proceeding.
Configure the firewall for a Power Pages production site. The firewall is only available on production sites and in supported regions — the scripts detect and report eligibility issues. After rule changes, edge propagation takes up to one hour.
Initial request: $ARGUMENTS
.powerpages-site/website.yml stores the website record id, not the portal id. Every script takes --portalId. Resolve once via website.js --websiteId during prerequisites.enable.js and disable.js poll until the status reaches the target value (or timeout). delete-rules.js returns immediately (202) — verify via get-rules.js.B003 means another enable/disable is in flight. Poll status until it settles, then retry.EnabledState: "Disabled" inside RuleGroupOverrides — managed rule fields use PascalCase).set-rules.js is additive / update-only. Send only rules being created or modified. The service merges them; existing rules not in the payload are untouched.delete-rules.js to remove rules. set-rules.js cannot remove. Always use delete-rules.js --names.Created is the only "enabled" state. get-status.js returns value: "Created" when the firewall is enabled and actively filtering (counter-intuitive — the API does NOT use "Enabled"). Any other value (Disabled, None, Enabling, Disabling, Failed) means no active policy exists. MUST call get-status.js first and only invoke get-rules.js when value is Created — otherwise the rules endpoint returns a 500 and the whole firewall section gets skipped in the report.Create tasks in three groups. Mark each in_progress when starting, completed when done.
| Group | When to create | Tasks | |-------|----------------|-------| | 1 | At start | Check prerequisites | | 2 | After prerequisites pass | Check firewall state · Choose an action (skip in review mode) | | 3 | After user confirms an action | Apply the change (skip in review mode OR no change action was chosen) · Summarize and next steps (always) |
Use Glob to find **/powerpages.config.json. If $ARGUMENTS contains --review <out-dir>, remember the output directory — Steps 3–4 are skipped and Step 5 writes JSON only.
Read .powerpages-site/website.yml → extract id field → that is <WEBSITE_ID>.
If missing, the site has not been deployed. Tell the user and recommend /deploy-site. Stop. Do not resolve by name or URL.
Resolve to portalId:
node "${PLUGIN_ROOT}/scripts/website.js" --websiteId "<WEBSITE_ID>"
Capture Id (portalId), Type, Name, WebsiteUrl. If exit code 2 → sign-in required (pac auth create or az login). If null → site not found in this environment. Stop in either case.
Check the Type field and the script responses for eligibility. The scripts return specific error codes for ineligible sites (non-production, unsupported region, restricted feature). Read references/commands.md § "Common error catalogue" and § "Regional availability" for the full list.
If the site is ineligible, tell the user in plain language what the limitation is and stop.
node "${PLUGIN_ROOT}/skills/manage-firewall/scripts/get-status.js" --portalId "<PORTAL_ID>"
The response shape is { "status": "ok", "value": "<state>" }.
Created — WAF is enabled and filtering. Proceed to 2.2 to fetch rules.Disabled, None, Enabling, Disabling, Failed, etc.) — WAF is not enabled. MUST NOT call get-rules.js — the rules endpoint will return a 500 because no active policy exists to read. Skip 2.2 and treat the rules payload as empty: { "status": "ok", "body": { "CustomRules": [], "ManagedRules": [] } }.If the status response is "status": "unsupported", tell the user the firewall is not available and stop.
node "${PLUGIN_ROOT}/skills/manage-firewall/scripts/get-rules.js" --portalId "<PORTAL_ID>"
Both scripts output the full response as JSON to stdout. If get-rules.js returns "status": "unsupported", tell the user the firewall is not available and stop.
Skip in review mode.
MUST use plain language only with the user. Never use words like WAF, OWASP, ModSec, ruleset, geo-block, rate-limit, ASN, SocketAddr, or rule priority.
Each AskUserQuestion call is a separate call. Wait for the user's answer before asking the next.
🚦 Gate (plan · manage-firewall:3.action-choice): Recommend an action based on the site's current state, then ask the user to accept or choose differently. Fires once per Phase 3 entry — loops back here if the user wants to make additional changes after Phase 4 applies the first one.
Trigger: Phase 3 entry (interactive mode only — skipped in review mode). Why we ask: Wrong-action firewall changes are visible to every site visitor; auto-recommend without consent can disable an active rule the maker added deliberately. Cancel leaves: Nothing — Phase 4 hasn't fired yet.
Analyze the site's current state (firewall status, existing custom rules, managed rules, region eligibility) and recommend the single most relevant action. Present the recommendation via AskUserQuestion:
If the site's state does not warrant a specific recommendation, do not force one — ask what the user wants to do.
MUST NOT proactively offer actions that reduce security (disabling the firewall, removing managed rules, weakening existing rules). If the user needs those, they will ask.
When presenting options via AskUserQuestion:
label to 1–5 words. Include description on every option.preview only when the option represents a concrete change (create, update, or delete a rule) — use it to show the configuration that will be applied so the user can review before approving. Do not add preview to navigation or informational choices.references/commands.md § "Regional availability").description — include the count and summarize what is configured so the user can decide whether to add or update.When the user picks "Add a rule", ask a follow-up for the rule type. The same option rules apply. Translate the answer into set-rules.js parameters — keep the user out of priority-numbering and rule-naming details. Read references/rule-reference.md for rule shapes.
List current custom rules showing: what each rule does (plain language), what traffic it matches, whether it blocks or allows, and its priority relative to others. If removing a rule would break a deny/allow pattern, warn before proceeding.
🚦 Gate (consent · manage-firewall:3.execute-consent): Final consent before any destructive WAF mutation (enable/disable, add/update/delete rule). Echoes the proposed JSON payload + the surfaced validation issues. Fires PER CHANGE — each enable, disable, rule add, rule update, and rule delete is its own consent.
Trigger: Phase 3 action chosen, plan + validation surfaced. Why we ask: Firewall changes are env-level and visible to every site visitor; auto-applying can lock out legitimate traffic or weaken protection. Cancel leaves: Nothing — the API call hasn't fired yet; the plan + validation are throwaway.
For all rule changes:
matchVariable/operator, overlapping matchValue) — explain which rule wins via first-match-winsAskUserQuestion:For deletions, show the rule names and what each currently does before proceeding.
In review mode, skip this step entirely.
Skip in review mode.
| Action | Script |
|--------|--------|
| Enable | enable.js --portalId <id> |
| Disable | disable.js --portalId <id> |
| Add / update rules | set-rules.js --portalId <id> --data-inline '<json>' |
| Remove rules | delete-rules.js --portalId <id> --names <comma-separated> |
Run enable/disable with run_in_background: true (async operations with built-in polling).
Before applying, show only the disclosure relevant to the action being taken:
After completion, re-run status and rules calls to verify the new state.
Apply the same status-then-rules gating as § 2 — get-rules.js MUST only be invoked when the status value is Created. For any other value the WAF policy does not exist and the rules endpoint will return 500; the orchestrator must write the empty-rules payload directly instead of calling the script.
Step A — always run status:
node "${PLUGIN_ROOT}/skills/manage-firewall/scripts/get-status.js" --portalId "<PORTAL_ID>" > "<REVIEW_DIR>/firewall-status.json"
Step B — branch on the captured value:
If value is Created, fetch rules:
node "${PLUGIN_ROOT}/skills/manage-firewall/scripts/get-rules.js" --portalId "<PORTAL_ID>" > "<REVIEW_DIR>/firewall-rules.json"
Otherwise (Disabled, None, Enabling, Disabling, Failed, anything else), do NOT call get-rules.js. Write the empty-rules payload yourself:
{ "status": "ok", "body": { "CustomRules": [], "ManagedRules": [] } }
After capturing the raw output, read both files and write <REVIEW_DIR>/firewall-annotations.json with plain-language descriptions of the state and each rule (the transform script no longer hardcodes these — they come from you):
{
"state": {
"description": "Plain-language explanation of what \"<value>\" means — is the firewall actively filtering requests, or not?",
"fix": "Optional — include only if the state genuinely needs action."
},
"rules": {
"<RuleName>": { "description": "What this rule does, in plain language.", "fix": "Optional fix if the rule has a genuine issue." }
}
}
Power Pages WAF state semantics (use these when writing the state description — do not invent meanings):
Created — WAF is enabled. The firewall is active and filtering requests.Disabled — WAF is not enabled and no firewall policy exists. The site is unprotected.None — no firewall policy has ever been provisioned. Same user-facing meaning as Disabled.Enabling / Disabling — operation in progress; wait.Failed — last enable/disable operation failed.Then run the transform:
node "${PLUGIN_ROOT}/skills/manage-firewall/scripts/transform-firewall.js" \
--statusFile "<REVIEW_DIR>/firewall-status.json" \
--rulesFile "<REVIEW_DIR>/firewall-rules.json" \
--annotations "<REVIEW_DIR>/firewall-annotations.json"
Write the transform stdout to <REVIEW_DIR>/manage-firewall.json and stop. The transform emits { status, findings }; the orchestrating skill handles presentation.
Plain-language summary: firewall on/off, rule count, what changed, important gaps.
Reference:
${PLUGIN_ROOT}/references/skill-tracking-reference.mdUse
--skillName "ManageFirewall".
If a natural follow-up action exists based on the site's verified post-action state, suggest it. Do not offer actions that reduce security. If no meaningful follow-up exists, end the skill — do not ask just to ask.
references/commands.md for the full error catalogue.run_in_background.set-rules.js payload MUST contain only new or modified rules.BlockCountries, AllowOfficeIP).preview only on options representing a concrete change the user needs to approve. Do not add to navigation or informational choices.references/commands.md — script flags, response shapes, error catalogue, regional availability. Read § "Common error catalogue" when a script returns a non-zero exit code. Read § "Regional availability" during eligibility checks.references/rule-reference.md — field-level schema for custom rules, match conditions, managed rule overrides, match variables, operators, and priority bands. Read when building a rule plan.tools
Adds Work IQ (M365 Copilot Search) to a Power Apps code app via the Work IQ Copilot MCP connector (shared_a365copilotchatmcp), then wires up a production-ready McpSession wrapper for AI-powered, knowledge-grounded search and chat. Use when integrating Microsoft 365 Copilot search/chat. The CopilotChat tool searches internal Microsoft 365 content (documents, emails, chats, sites, files) across your organization — prefer workload-specific tools (SharePoint, OneDrive, Teams, Mail) when the workload is explicit; do not use it for general knowledge, news, public web, or external information.
tools
Use when the user wants to preview generated screens in a browser without starting Metro / a simulator — for example after /create-mobile-app finishes or after /edit-app regenerates a screen.
development
Use when the user wants to iterate on an existing generated Power Apps mobile app after /create-mobile-app: update the plan, data model, native capabilities, design, screens, generated app code, and preview without restarting the full project flow.
development
Creates and manages the brand design system for a Power Apps mobile app. Generates brand/design-system.md (source of truth), brand/tokens.ts (importable Tamagui tokens), and brand/design-system.html (visual gallery). Triggered at Step 6.5 of /create-mobile-app, or standalone via /design-system.