Skip to main content

Fixed: Power Platform CLI Says "An unknown argument --help was passed."

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

I asked the Power Platform CLI for a command's help the way many command-line tools take it, with --help, and it answered Error: An unknown argument --help was passed. Its help is a word you add after the command, help, with no dashes.

What I Was Doing​

I was writing a guide to deleting a CLI profile (How to Delete a Power Platform CLI Profile with pac auth delete), and wanted the command's options in the terminal before running it. Many command-line tools print a command's help when you add --help, so I typed:

Terminal
pac auth delete --help

This was pac 2.16.1 on macOS, installed as a .NET tool, with two profiles saved on the computer.

What I Expected​

The command's help: what it does and its options, with no error.

What I Got​

An error, with the usage below it:

A Terminal window: pac auth delete --help, the CLI's version lines, Error: An unknown argument --help was passed., then Usage: pac auth delete [--index] [--name] and the two options with their descriptions

Output
Microsoft PowerPlatform CLI
Version: 2.16.1+gf5bc887 (.NET 10.0.15)
Online documentation: https://aka.ms/PowerPlatformCLI
Feedback, Suggestions, Issues: https://github.com/microsoft/powerplatform-build-tools/discussions

Error: An unknown argument --help was passed.

Usage: pac auth delete [--index] [--name]

--index The index of the profile to be deleted (alias: -i)
--name The name of the profile to be active (alias: -n)

What I Checked​

1. What came after the error​

The usage line and both options were there. The help I wanted was printed, below an error.

2. Whether anything was deleted​

No. pac auth list still showed both profiles afterwards: the command stopped at the error.

3. Microsoft's documentation​

The Next steps section of What is Microsoft Power Platform CLI? says how to get help:

For the complete list of supported commands, run the pac help command or pac <subcommand> help - for example: pac solution help.

The command reference has a page for pac help, "Show help for the Microsoft Power Platform CLI." Neither mentions --help.

4. What pac help prints​

It lists every command group, each with a line about what it's for:

Terminal
pac help
Output (first lines)
Microsoft PowerPlatform CLI
Version: 2.16.1+gf5bc887 (.NET 10.0.15)
Online documentation: https://aka.ms/PowerPlatformCLI
Feedback, Suggestions, Issues: https://github.com/microsoft/powerplatform-build-tools/discussions

Usage: pac [admin] [analytics] [app-management] [application] [auth] [authorization] [canvas] [catalog] [code] [connection] [connectivity] [connector] [copilot] [copilot-studio] [dynamics] [env] [environment-management] [governance] [help] [licensing] [managed-identity] [model] [modelbuilder] [monitoring-hub] [notification-service] [package] [pages] [pcf] [pipeline] [plugin] [power-apps] [power-automate] [power-fx] [power-pages] [resource-query] [solution] [telemetry] [tool] [user-management] [workflows-agent]

admin Work with your Power Platform Admin Account.
analytics (Preview) Retrieve and run Power Platform advisor recommendations and remediations.
app-management (Preview) Discover and install Dynamics 365 application packages into environments.
application Commands for listing and installing available Dataverse applications from Microsoft Marketplace.
auth Manage how you authenticate to various services.

Why It Happens​

The message says it: pac took --help as an option of pac auth delete, which has only two, --index and --name. An option the command doesn't have is an unknown argument, so the CLI stops there and shows the usage instead. The CLI's help isn't an option at all. It's the word help, added after a group or a command, as Microsoft's overview describes.

The Fix​

Put help after the command, without dashes:

To seeRun
One command's helppac auth delete help
A group's commandspac auth help
Every command grouppac help

After the Fix​

Terminal
pac auth delete help

The same help, with a line saying what the command does, and no error:

A Terminal window: pac auth delete help, the CLI's version lines, Help: Delete a particular authentication profile, then Usage: pac auth delete [--index] [--name] and the two options, with no error

Output
Microsoft PowerPlatform CLI
Version: 2.16.1+gf5bc887 (.NET 10.0.15)
Online documentation: https://aka.ms/PowerPlatformCLI
Feedback, Suggestions, Issues: https://github.com/microsoft/powerplatform-build-tools/discussions

Help:
Delete a particular authentication profile

Commands:
Usage: pac auth delete [--index] [--name]

--index The index of the profile to be deleted (alias: -i)
--name The name of the profile to be active (alias: -n)

One level up, pac auth help lists the group's commands. Running pac auth on its own printed exactly the same:

Terminal
pac auth help
Output
Microsoft PowerPlatform CLI
Version: 2.16.1+gf5bc887 (.NET 10.0.15)
Online documentation: https://aka.ms/PowerPlatformCLI
Feedback, Suggestions, Issues: https://github.com/microsoft/powerplatform-build-tools/discussions

Help:
Manage how you authenticate to various services.

Commands:
Usage: pac auth [create] [list] [select] [delete] [update] [name] [clear] [who] [token]

create Create and store authentication profiles on this computer
list List the authentication profiles stored on this computer
select Select which authentication profile should be active
delete Delete a particular authentication profile
update Update name or target environment of an existing authentication profile
name Name or rename an existing authentication profile
clear Clear all authentication profiles stored on this computer
who Display information about currently selected authentication profile
token Display a Power Platform API access token for the currently selected authentication profile

Common Mistakes​

MistakeWhat happensDo this instead
Adding --help to a commandAn unknown argument --help was passed.Add help, without dashes
Stopping at the errorYou miss the usage printed right below itRead on, or run the command with help
Running a command to find out what it doesSome commands change things: pac auth delete removes a profileRead its help first

Troubleshooting​

SymptomLikely causeFix
An unknown argument --help was passed.--help isn't the CLI's helppac <group> <command> help
An unknown argument with another optionThe command doesn't have that optionCheck the Usage line in its help
pac isn't foundThe CLI isn't installed, or its folder isn't on your pathHow to Sign In to the Power Platform CLI with pac auth create shows the checks

FAQ​

Does help work for every command?​

Microsoft's overview gives it for every group, with pac solution help as its example. I ran it at all three levels, pac help, pac auth help and pac auth delete help, and none of them printed an error.

Is the help the same as Microsoft's reference?​

Yes, for this command: the pac auth reference lists the same two options with the same descriptions. Both say --name is "The name of the profile to be active", but pac auth delete --name deletes the profile you name, as the guide shows.

Did --help change anything?​

No. The command stopped at the error, and both profiles were still listed afterwards.

Conclusion​

pac auth delete --help printed Error: An unknown argument --help was passed., because the command has no option called --help. The Power Platform CLI's help is the word help after a group or a command: pac auth delete help printed the same usage, with what the command does and no error.

Additional Resources​