Skip to main content

cli completion pwsh setup

Sets up command completion for PowerShell


m365 cli completion pwsh setup [options]


-p, --profile <profile>

Path to the PowerShell profile file

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.


Runs command with verbose logging.


Runs command with debug logging.


This commands sets up command completion for the CLI for Microsoft 365 in PowerShell by registering a custom PowerShell argument completer in the specified profile. Because CLI for Microsoft 365 is not a native PowerShell module, it requires a custom completer to provide completion.

If the specified profile path doesn't exist, the CLI will try to create it.


Set up command completion for PowerShell using the profile from the profile variable

m365 cli completion pwsh setup --profile $profile


The command won't return a response on success.

More information