Skip to main content

Power Automate from the terminal: GitHub Copilot CLI + Microsoft's Power Platform plugin

PS C:\> copilot-win32-x64 -p "List my Power Automate environments"
Power Automate from the Terminal
GitHub Copilot CLI + Microsoft's Power Platform plugin

What if you could create, debug and manage Power Automate flows by typing plain English into a terminal? Microsoft now publishes a Power Platform plugin for GitHub Copilot CLI that does exactly that. I set it up end to end and wrote a runbook, so you don't have to hit the same walls I did.

The runbook covers installing everything, the three errors that will almost certainly trip you up, the prompts that actually work, and how to build flows your Copilot Studio agents can call. It was verified on Windows 11 Pro (26200) with PowerShell 7.6.5 and Node v20.2.0.

What you can do with it

  • Discover: list environments and flows, find the flows that failed in the last 24 hours, and get an inventory report of every flow and its owner.
  • Create: describe a flow in a sentence ("runs weekdays at 9am, reads overdue rows from a SharePoint list and emails a summary"), and the plugin builds it.
  • Debug: ask why the last run failed, or run a deep diagnosis of a specific run with the root cause and a proposed fix.
  • Manage: publish flows, turn off the ones that haven't run in 90 days, and work with desktop flows and machine groups.
  • Build agent actions: create flows with the right trigger and response for Copilot Studio agents.

Under the hood, the power-automate plugin adds 10 skills and a flowagent MCP server to GitHub Copilot CLI. It gets its Power Automate access through Azure CLI.

Before you start

RequirementTargetWhy it matters
PowerShell7.0+Windows PowerShell 5.1 won't run these reliably. Use pwsh, not powershell.
Node.js20.6+Below 20.6 the copilot command breaks. There's a workaround (Gotcha 1).
npm9.0+Ships with Node and installs the CLI package.
wingetanyInstalls Azure CLI. It's preinstalled on Windows 11.

You also need a GitHub account with Copilot access and a Microsoft work account with a Power Automate licence. They're two separate sign-ins.

Install in six steps

1. Install Azure CLI

● ● ●  PowerShell 7
PS C:\> winget install --exact --id Microsoft.AzureCLI --accept-package-agreements --accept-source-agreements
Found Microsoft Azure CLI [Microsoft.AzureCLI] Version 2.90.0
Successfully verified installer hash
Starting package install...
Successfully installed

The plugin gets its token through az. Power Platform CLI (pac) does not work as a substitute, even if you already have it.

2. Refresh your PATH

Open a new terminal tab, or run this in the current one:

● ● ●  PowerShell 7
PS C:\> $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
PS C:\> az version

3. Install GitHub Copilot CLI

● ● ●  PowerShell 7
PS C:\> npm install -g @github/copilot
PS C:\> copilot --version
# If that errors, install the platform package too:
PS C:\> npm install -g @github/copilot-win32-x64@1.0.83

npm often skips the platform-specific binary because it's an optional dependency. Installing it yourself is safe either way.

4. Sign in, twice

● ● ●  PowerShell 7
PS C:\> copilot-win32-x64 login
Opening your browser to authenticate...
Waiting for authorization...
Signed in successfully as octocat.

PS C:\> az login --allow-no-subscriptions

Use --allow-no-subscriptions from the start. Plain az login fails on most Power Automate tenants (Gotcha 3).

5. Add the marketplace and the plugin

● ● ●  PowerShell 7
PS C:\> copilot-win32-x64 plugin marketplace add microsoft/power-platform-skills
Marketplace "power-platform-skills" added successfully.

PS C:\> copilot-win32-x64 plugin install power-automate@power-platform-skills
Plugin "power-automate" installed successfully. Installed 10 skills.

The same marketplace has seven sibling plugins, including power-pages, canvas-apps and model-apps.

6. Check it works

● ● ●  GitHub Copilot CLI
PS C:\> copilot-win32-x64 -p "List my Power Automate environments" --allow-all-tools

● skill(route-environments)
● List Environments (MCP: flowagent)              6s
● Resolve Environment (MCP: flowagent)            6s

Your Power Automate environments:

| Environment       | Type      | Region | Default |
|-------------------|-----------|--------|---------|
| Contoso           | Teams     | Asia   | No      |
| Contoso (default) | Default   | Asia   | Yes     |
| Dev Sandbox       | Developer | Asia   | No      |

Your current environment resolves to Contoso (default).
AI Credits 0.91 (20s)
Environments listed and a default resolved: GitHub sign-in, Azure token, plugin and MCP server are all working. (Tenant names are placeholders.)

Three things that will trip you up

Gotcha 1: the copilot command fails on Node below 20.6

● ● ●  PowerShell 7
PS C:\> copilot --version
GitHub Copilot CLI: no platform package found. Reinstall with
`npm install -g @github/copilot` to fetch the package for your platform.

PS C:\> copilot-win32-x64 --version
GitHub Copilot CLI 1.0.83.

The error tells you to reinstall, but reinstalling never fixes it. The launcher uses a Node feature that only arrived in 20.6. Either upgrade Node, or call the platform command copilot-win32-x64 directly. That's what every command in the runbook uses, so it works on any Node version.

Gotcha 2: terminals opened before an install can't see the new command

● ● ●  PowerShell 7
PS C:\> az login
az: The term 'az' is not recognized as a name of a cmdlet, function,
script file, or executable program.

PowerShell reads PATH when the window opens. Open a new tab, or refresh PATH as in step 2.

Gotcha 3: az login refuses a tenant with no subscriptions

● ● ●  PowerShell 7
PS C:\> az login
The following tenants don't contain accessible subscriptions.
Use `az login --allow-no-subscriptions` to have tenant level access.
No subscriptions found for admin@contoso.com.

Power Automate is licensed through Microsoft 365, not Azure, so it's normal for your tenant to have no Azure subscriptions. The plugin only needs a tenant-level token, so use az login --allow-no-subscriptions.

Working with flows

There are two modes. Interactive (just run copilot-win32-x64) asks before acting and remembers the conversation, which is best while learning. Prompt mode (-p) runs one instruction, which is good for scripts.

● ● ●  Examples
# Discover
PS C:\> copilot-win32-x64 -p "Show flows that failed in the last 24 hours" --allow-all-tools
PS C:\> copilot-win32-x64 -p "Give me an inventory report of all flows and their owners" --allow-all-tools

# Create
PS C:\> copilot-win32-x64 -p "Create a flow in Dev Sandbox that runs weekdays at 9am,
  reads rows from the SharePoint list 'Vendor Reviews' where Status is Overdue,
  and emails a summary table to the list owner. Validate before creating." --allow-all-tools

# Debug
PS C:\> copilot-win32-x64 -p "Debug the most recent failed run of flow 'Copilot CLI Demo'" --allow-all-tools

# Manage
PS C:\> copilot-win32-x64 -p "Turn off all flows in Dev Sandbox that have not run in 90 days" --allow-all-tools
Tip: always say "validate before creating". The plugin then checks the flow definition against the Power Automate schema first. Without it, an invalid definition fails at create time and you spend credits on the retry.

Flows for Copilot Studio agents

A Copilot Studio agent calls a flow as an action. If any of these four rules is broken, the flow won't even appear in the agent's action list:

RuleWhat it means
Same environmentThe flow must be in the same environment as the agent.
TriggerWhen an agent calls the flow (not manual, scheduled or HTTP).
ResponseIt must end with Respond to the agent, returning typed outputs.
SolutionTo ship it with the agent, the flow must be in the same solution.
● ● ●  GitHub Copilot CLI
PS C:\> copilot-win32-x64 -p "Create a flow in Dev Sandbox using the
  'When an agent calls the flow' trigger. Input: a text parameter named VendorName.
  Look up that vendor in the SharePoint list 'Vendor Register' and return the
  vendor's Tier and RiskRating using 'Respond to the agent'.
  Validate before creating." --allow-all-tools

Then in Copilot Studio, open the agent and go to Actions, then Add an action, and pick the flow. Write the flow's description carefully, because that's what the agent matches against the user's request.

Add the flow to the solution before you export the agent. A flow created outside the solution works while you test, then disappears when the solution is imported elsewhere, and the agent's action quietly fails.

Permissions and cost

Prompt mode needs permission up front. --allow-all-tools lets Copilot run anything on your machine without asking. That's fine for a trusted local session, but narrow it for scripts:

● ● ●  Permission flags
# only Azure CLI and Power Platform CLI
--allow-tool='shell(az:*)' --allow-tool='shell(pac:*)'

# everything except git push
--allow-tool='shell(git:*)' --deny-tool='shell(git push)'

Scoping works, but test it: a run scoped to shell(az:*) was still refused az --version and had to work around it. Start narrow and widen only where a run gets blocked.

RunGitHub Copilot AI creditsTime
Prerequisite check1.2329 s
Listing environments0.9120 s

This is billed as GitHub Copilot AI credits. Creating a flow takes longer than either of these.

Check your environment before creating anything. The CLI uses your default environment, which is rarely where you want to experiment. Run copilot-win32-x64 -p "Check my environment routing" --allow-all-tools first.

The ten skills

You never call these by name. Copilot picks one from how you phrase the request, so knowing them tells you what to say:

SkillSay something like
setup"check my prerequisites"
route-environments"which environment am I in"
browse-flows"list my flows"
create-flow"create a flow" (guided, asks questions)
build-flow"build a flow that…" (one shot)
debug-flow"why did my flow fail"
diagnose-flow"diagnose run <id>" (deep, needs the ids)
manage-flows"publish", "test", "inventory report"
manage-desktop-flows"desktop flows", "machine groups"
report-issue"report a bug in the plugin"

Not a Claude Code plugin

This installs into GitHub Copilot CLI and only works there. It won't appear in Claude Code's plugin list. The two complement each other: Claude Code has its own copilot-studio plugin for building agents, and this one builds the flows those agents call.

A few honest notes

  • Everything up to listing environments is verified end to end: install, both sign-ins, the plugin (v3.0.5, 10 skills) and the MCP server. Creating a flow isn't verified yet in my test tenant, because I first need to point it at the Dev Sandbox environment rather than the default.
  • Tenant and environment names in the outputs are placeholders.
  • Tested on Windows 11 with PowerShell 7. Other setups may need small changes.
  • --allow-all-tools gives Copilot full shell access. Only use it in a session you trust.
Get the runbook
The full step-by-step guide: github.com/shenukaf69/power-automate-cli-runbook
Microsoft's plugins: microsoft/power-platform-skills
GitHub Copilot CLI plugins: GitHub docs

If it saves you an afternoon, a star on GitHub is much appreciated. Tell me what you build with it.

This runbook is an independent project by Shenuka Fernando, released under the MIT licence. It is not affiliated with Microsoft or GitHub. Microsoft, Power Automate, Power Platform, Copilot Studio and Azure are trademarks of the Microsoft group of companies. GitHub and GitHub Copilot are trademarks of GitHub, Inc.

Comments

Popular posts from this blog

Microsoft power apps to generate day end email stats

  Power automate to generate a report to get total incoming outgoing emails in my mailbox for the day You can use Microsoft Power Automate (formerly Microsoft Flow) to generate a report of the total number of incoming and outgoing emails in your mailbox for a specific day. Here's a basic example of how you can get started: Create a new flow: Start by creating a new flow in Power Automate. You can choose a template or start from scratch, depending on your preference. Connect to your email account: Next, connect Power Automate to your email account. You can use the Office 365 Outlook Connector or the Exchange Connector, depending on which email service you use. Trigger the flow: Choose a trigger for the flow that will run it automatically on a schedule. For example, you could use the "Recurrence" trigger to run the flow every day at a specific time. Count the emails: Use the "Get email" action to retrieve all the emails in your inbox for the specific day. Then, us...

Microsoft Viva Insights and Viva Insights Manager app

  Microsoft Viva Insights is a platform designed to help organizations promote employee well-being and productivity by providing data-driven insights and recommendations. It is an AI-powered tool that provides personalized insights to individuals, managers, and leaders. Viva Insights uses data from multiple sources such as Office 365, LinkedIn, and other business applications to analyze work patterns and provide insights on employee well-being, productivity, and collaboration. The platform is designed to help individuals manage their work-life balance by providing insights and recommendations on managing work hours, prioritizing tasks, and taking breaks. It also enables managers to identify potential burnout risks, track employee engagement, and support their team's well-being. Viva Insights provides a range of reports and dashboards that allow organizations to track employee well-being and productivity metrics and make data-driven decisions to support their employees. Additionally...

Microsoft Copilot: Your AI-powered Productivity Partner

Microsoft Copilot is not just a name; it's a vision for the future of work. It's a suite of AI-powered tools designed to revolutionize the way we work, making us more efficient, creative, and productive. Copilot isn't just one tool; it's an ever-evolving ecosystem of features and functionalities that are constantly being updated and improved. What is Microsoft Copilot? At its core, Microsoft Copilot is a large language model (LLM) chatbot developed by Microsoft. It was initially launched as Bing Chat in February 2023 and has since evolved into a more comprehensive suite of tools integrated into various Microsoft products and services. Copilot leverages the power of LLMs to understand your needs and provide assistance in various ways, from simple tasks like answering questions to more complex tasks like generating creative content or summarizing documents. Copilot in Action Here are some of the ways Copilot can be used to enhance your productivity: Microsoft 365 Copilot:...