The Azure CLI is really great for writing imperative scripts for automating Microsoft Azure resource management. Generally, the command output is helpful in telling you that updates were made or returning values that can be used for setting variables and then passing into additional commands your script will be running. However, what if you don’t want an Azure CLI command to output anything?

Sometimes in the process of infrastructure and service management you need to run Azure CLI commands where it would be nice if they didn’t output anything unless a standard error occurred. Reasons for this could be that you just want your script output to be cleaner with only your own console outputs displayed. Or, you might not want to output anything from the Azur e CLI command output that may contain secrets or password. In these cases, it would be really helpful if there were a way to suppress Azure CLI command output so the command is completely silent.

To run Azure CLI commands in a sort of “quiet mode“, all you need to do is pass in the --output argument with the value of none; like the following:

# --output argument set to suppress all output after execution
az [command] --output none

# -o shorthand usage set to none
az [command] -o none

In most cases it’s very helpful to have the output of the Azure CLI command tell you something of what it did. Generally it’ll be the JSON output telling you the full properties of the resource, or even what application settings are currently set on an App Service app or Function app. However, there are time when the output may contain secrets that you might not want logged to the output of Azure DevOps pipelines or GitHub Actions logs. In these cases, the --output none or -o none arguments passed into an Azure CLI command are really good. They just might save you when your logs get audited for some reason and as a result of using --output none you are not leaking any secrets (or passwords) to others in the organization that should not have access to view those secrets.

I recently used the --output none argument on some Azure CLI commands in some Azure DevOps pipelines myself, so I thought I’d share this extremely simple but extremely useful Azure CLI Kung Fu tip. Enjoy!

Microsoft MVP

Chris is the Founder of Build5Nines.com and a Microsoft MVP in Azure & IoT with 20 years of experience designing and building Cloud & Enterprise systems. He is also a Microsoft Certified: Azure Solutions Architect, developer, Microsoft Certified Trainer (MCT), and Cloud Advocate. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.