PowerShell module for handling AzureCLI command output more like a native PowerShell command.
Replaces the az command with an alias to Invoke-AzCommand that changes the behavior of az from the AzureCLI in the following ways:
- Output is parsed as json unless the
-o|--outputparameter is specified as something other thanjson|jsoncand the-h|--helpparameter is not specified - Error stream output is parsed into
Write-Warning,Write-Error,Write-Verbose, andWrite-Debugstreams, progress bars are ignored - Automatically injects the
--verboseparameter if$VerbosePreferenceis notSilentlyContinue - Automatically injects the
--debugparameter is$DebugPreferenceis notSilentlyContinue - Uses
Write-Hostto log the command if run from an Azure DevOps Pipeline or GitHub Actions workflow
Converts an array, object, or hashtable to JSON and encodes it for use with the az parameters that take JSON input.
az deployment group create -g {} -f {} `
-p param1=$(@{x=1;y=2} | ConvertTo-AzJson)
az deployment group create -g {} -f {} `
-p param1=$(@{x=1},@{x=2} | ConvertTo-AzJson -AsArray)Converts an array, object, or hashtable to JSON and saves it in a file for use with the az parameters that take JSON input from a file.
az rest -m POST -u {} -b "@$(@{x=1;y=2} | Out-AzJsonFile)"
az rest -m POST -u {} -b "@$(@{x=1},@{x=2} | Out-AzJsonFile -AsArray)"Note: If the -Path parameter is not specified a temporary file is used.
Converts an object or hashtable to a ARM template deployment parameters file.
az deployment group create -g {} -f {} `
-p "@$(@{param1='value';param2=@('x','y');param3=$true;param5=@{x=1;y=2}} | Out-AzDeploymentParameters)"Note: If the -Path parameter is not specified a temporary file is used.