Skip to content

Use secure parameters for sensitive information#

Security · Deployment · Rule · 2023_12 · Critical

Use secure parameters for any parameter that contains sensitive information.


Azure Bicep and Azure Resource Manager (ARM) templates can be used to deploy resources to Azure. When deploying Azure resources, sensitive values such as passwords, certificates, and keys should be passed as secure parameters. Secure parameters use the secureString or secureObject type.

Parameters that do not use secure types are recorded in logs and deployment history. These values can be retrieved by anyone with access to the deployment history.


Consider using secure parameters for parameters that contain sensitive information.


Configure with Azure template#

To configure deployments that pass this rule:

  • Set the type of sensitive parameters to secureString or secureObject.

For example:

Azure Template snippet
  "$schema": "",
  "contentVersion": "",
  "parameters": {
    "secret": {
      "type": "secureString"
  "resources": [
      "type": "Microsoft.KeyVault/vaults/secrets",
      "apiVersion": "2022-07-01",
      "name": "keyvault/good",
      "properties": {
        "value": "[parameters('secret')]"

Configure with Bicep#

To configure deployments that pass this rule:

  • Add the @secure() attribute on sensitive parameters.

For example:

Azure Bicep snippet
param secret string

resource goodSecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
  parent: vault
  name: 'good'
  properties: {
    value: secret


This rule uses a heuristics to determine if a parameter should use a secure type:

  • Parameters with the type int or bool are ignored regardless of how they are named.
  • Any parameter with a name containing password, secret, or token will be considered sensitive.
    • Except parameter names containing any of the following: length, interval, secretname, secreturl, secreturi, secrettype, secretrotation, secretprovider, secretsprovider, secretref, secretid, disablepassword, sync*passwords, tokenname, tokentype, keyvaultpath, keyvaultname, or keyvaulturi.
  • Any parameter with a name ending in key or keys will be considered sensitive.
    • Except parameter names ending in publickey or publickeys.

Rule configuration#


If you identify a parameter that is not sensitive, and is incorrectly flagged by this rule, you can override the rule. To override this rule:

  • Set the AZURE_DEPLOYMENT_NONSENSITIVE_PARAMETER_NAMES configuration value to identify parameters that are not sensitive.