last sync: 2021-Sep-22 19:36:51 UTC

Azure Policy definition

Secrets should have content type set

Name Secrets should have content type set
Azure Portal
Id 75262d3e-ba4a-4f43-85f8-9f72c090e5e3
Version 1.0.1
details on versioning
Category Key Vault
Microsoft docs
Description A content type tag helps identify whether a secret is a password, connection string, etc. Different secrets have different rotation requirements. Content type tag should be set on secrets.
Mode Microsoft.KeyVault.Data
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Default: Audit
Allowed: (Audit, Deny, Disabled)
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-08-30 14:27:30 change Patch, old suffix: preview (1.0.0-preview > 1.0.1)
2020-10-16 12:27:50 add 75262d3e-ba4a-4f43-85f8-9f72c090e5e3
Used in Initiatives none
JSON Changes

JSON
{
  "displayName": "Secrets should have content type set",
  "policyType": "BuiltIn",
  "mode": "Microsoft.KeyVault.Data",
  "description": "A content type tag helps identify whether a secret is a password, connection string, etc. Different secrets have different rotation requirements. Content type tag should be set on secrets.",
  "metadata": {
    "version": "1.0.1",
    "category": "Key Vault"
  },
  "parameters": {
    "effect": {
      "type": "String",
      "metadata": {
        "displayName": "Effect",
        "description": "'Audit' allows a non-compliant resource to be created, but flags it as non-compliant. 'Deny' blocks the resource creation. 'Disable' turns off the policy."
      },
      "allowedValues": [
        "Audit",
        "Deny",
        "Disabled"
      ],
      "defaultValue": "Audit"
    }
  },
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.KeyVault.Data/vaults/secrets"
        },
        {
          "field": "Microsoft.KeyVault.Data/vaults/secrets/contentType",
          "exists": false
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]"
    }
  }
}