Skip to 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
output usage information
--query [query]
JMESPath query string. See for more information and examples
-o, --output [output]
Output type. json,text,csv. 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

cli completion pwsh setup --profile $profile

More information