-
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 14 replies
-
This blog post may help https://rajbos.github.io/blog/2019/07/12/Azure-CLI-PowerShell |
Beta Was this translation helpful? Give feedback.
-
Hi @waldekmastykarz and @garrytrinder ,
|
Beta Was this translation helpful? Give feedback.
-
We've just released support for configuring error output to |
Beta Was this translation helpful? Give feedback.
-
Hi @waldekmastykarz and @veronicageek, This lets you handle exceptions in a simpler way using the CLI
|
Beta Was this translation helpful? Give feedback.
-
Hi, m365 cli config set --key output --value json
m365 cli config set --key errorOutput --value stdout
m365 cli config set --key showHelpOnFailure --value false
m365 cli config set --key printErrorsAsPlainText --value false
function Get-CLIValue {
[cmdletbinding()]
param(
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
$input
)
$output = $input | ConvertFrom-Json
if ($output.error -ne $null) {
throw $output.error
}
return $output
}
try {
// this command will fail due to missing parameters
$convertedObject = m365 teams team get | Get-CLIValue
}
catch {
Write-Host $_.Exception.Message -ForegroundColor Red
} //cc @veronicageek Cheers, |
Beta Was this translation helpful? Give feedback.
Hi,
the latest version of the CLI allows you to make it even simpler.