pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
912 stars 319 forks source link

Running m365 setup --scripting on an Azure PowerShell Function does not set the errorOutput stream correctly #5977

Open martinlingstuyl opened 5 months ago

martinlingstuyl commented 5 months ago

It seems I've got an issue here.

I've got an Azure Function on PowerShell Core (on Windows OS) I'm running the CLI for Microsoft 365 on it. (version 7.7 beta) I'm configuring the CLI using m365 setup --scripting --output none.

I'm now expecting the following keys:

{
  "autoOpenLinksInBrowser": false,
  "copyDeviceCodeToClipboard": false,
  "output": "json",
  "printErrorsAsPlainText": false,
  "prompt": false,
  "showHelpOnFailure": false,
  "showSpinner": false,
  "errorOutput": "stdout"
}

But instead, if I write m365 config list to the output log, I'm getting the following: image

I'm missing the errorOutput config key, which means that errors are written to the stderr/error stream, instead of to the stdout/output stream. I want to write them to stdout, so I now have to run an additional m365 config set.

The command m365 setup should detect that powershell is running, but it doesn't.

waldekmastykarz commented 5 months ago

I wonder what's the parent process is. We should extend the setup command with debug logging which outputs the parent process name.