Loading...

Hardening your defense in depth with secrets awareness in Azure command line tools

Hardening your defense in depth with secrets awareness in Azure command line tools

When using one of the Azure client tools, you will likely have to deal with secrets that are returned by the Azure APIs. A common scenario would be to retrieve a storage account key to be able to perform other operations subsequently in your pipeline.

 

DevOps engineer developing scripts to be used in the pipelines should pay attention to the sensitivity of the output of the commands being executed at the risk of exposing sensitive information. This becomes particularly important when the output of commands is stored in log files like this would be the case in GitHub actions or other DevOps runners.

This scenario was recently described in details in this article from Palo Alto Network.

 

“Forewarned is forearmed”

 

The issue mentioned in the blog from Palo Alto Networks has been fixed in az cli version 2.54 and Azure PowerShell v11.0, however we wanted to provide our customers with a solution that is adaptive to similar situations regardless of the command outputs format or version of the client.

 

We think that our customers will take the decisions that fits their business needs if we give them the adequate information. Our first step is to detect secrets in the output of any command and display a warning message when a secret has been identified.

The following image shows the warning message with az cli version 2.57, available on February 6, 2024.

 

Picture1.png

 

We will enable a similar capability in Azure PowerShell in the next few weeks, stay tuned! 

Availability and default behavior

 

Local installation, Azure DevOps, GitHub action, etc… : Disabled by default.

Adding a warning message in the output of a command line tool may break DevOps pipelines that rely on the tool, so initially, this is disabled by default.

We encourage you to try it out and see if you are exposing secrets in any of your pipelines.

 

CloudShell: Enabled by default.

Because ClouShell is not indented to be used to execute pipelines and because this capability is security related, we are activating this feature by default in CloudShell.

 

Configuration

 

The following options controls the behavior of Azure CLI regarding the detection of secrets.

 

Environment variable

AZURE_CLIENTS_SHOW_SECRETS_WARNING=True

Value:

  • True: warning message will be displayed
  • False: warning message will NOT be displayed

 

Azure cli setting

az config set clients.show_secrets_warning=True

Warning messages will be displayed

 

az config set clients.show_secrets_warning=False

Warning messages will NOT be displayed

 

Additional considerations

 

Impact on your pipelines

Read the following before activating the warning message in DevOps pipelines! We use the stderr stream to show the warning message, this may cause issues if your DevOps pipeline is configured to fail in such circumstances.

 

For example, if the ‘failOnStderr’ parameter is set to ‘True’ of the Bash v3 task for Azure DevOps, the warning message will halt the pipeline.

 

Is it a good or a bad thing? It really depends how certain you are that there are no secrets in your Azure DevOps logs. You could consider enabling the warning message to identify if any secrets are exposed in your pipelines and take remediation actions.

 

Secrets identification

This version identifies a limited set of secrets, like access tokens, storage account keys, … and we will enrich our list in the upcoming releases.

 

Feedback

We believe this will help anyone using Azure CLI hardening their security defense in depth and be more conscious of secrets.

 

We want to hear from your experience with warning on secrets in command outputs. Please share a comment or open a GitHub issue https://github.com/Azure/azure-cli/issues/new/choose

 

Published on:

Learn more
Need help with this product?

We can help you with Hardening your defense in depth with secrets awareness in Azure command line tools

If you want help implementing, troubleshooting, or improving this product, contact us and we’ll point you in the right direction.

Azure Tools Blog articles
Azure Tools Blog articles

Azure Tools Blog articles

Share post:

Related posts

Unlocking the Best of Azure with AzureRM and AzAPI Providers

With the recent release of AzAPI 2.0, Azure offers two powerful Terraform providers to meet your infrastructure needs: AzureRM and AzAPI. The ...

1 year ago

Announcing AzAPI 2.0

The AzAPI provider, designed to expedite the integration of new Azure services with HashiCorp Terraform, has now released 2.0. This updated ve...

1 year ago

Azure CLI docker container base Linux image is now Azure Linux

Starting from the version  2.64.0 of Azure CLI, the base Linux distribution of Azure CLI is now Azure Linux.   Impact of the change ...

1 year ago

Mastering the Shorthand Syntax in your daily workflow

Introduction In this tech blog, we'll unravel the magic behind Azure CLI shorthand syntax and discover how it can elevate your command-line ex...

2 years ago

Azure Verified Modules - Monthly Update [June]

AVM Module Summary The AVM team are excited that our community have been busy building AVM Modules. As of June 17th, the AVM Footprint curren...

2 years ago

Azure Verified Modules - Monthly Update [May]

Quarterly Community Call This month we held our first community call. Thank you to everyone that attended & contributed. It was amazing t...

2 years ago

Azure CLI and PowerShell Tools Build 2024 Announcement

Microsoft has announced several new capabilities for Azure CLI and Azure PowerShell at the Microsoft Build 2024. The priority remains to provi...

2 years ago

Terraform on Azure May 2024 Update

    Welcome to our April 2024 update! These blogposts will be covering everything we've gotten up to recently with Terraform on Azu...

2 years ago

Azure Verified Modules - Monthly Update [April]

In the April edition of the Azure Verified Modules update, the AVM team announces their upcoming quarterly community call scheduled for 21st M...

2 years ago

Announcing AzAPI Dynamic Properties

  It’s been almost two years since the announcement of AzAPI, and the provider has eclipsed 20M+ downloads thanks to all of you. We’re ex...

2 years ago

Newsletter

Get the latest Dynamics 365 and Power Platform content in your inbox

A curated digest of community blogs, product news, videos, and podcasts — delivered without the noise.

Weekly updates Unsubscribe anytime Fresh community picks
We use your email only for the newsletter and you can unsubscribe at any time.
By subscribing, you agree to the privacy policy.