Bylaw

Gallery › Automation › Azure Community Policy

Audit encryption of Automation account variables

Converted Policy Audit Disabled Mode All Version 1.0.0

It is important to enable encryption of Automation account variable assets when storing sensitive data

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONazurepolicy.json · 44 lines
{
  "name": "fdadbfa5-162a-4d33-a804-c22efc03970d",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Audit encryption of Automation account variables",
    "description": "It is important to enable encryption of Automation account variable assets when storing sensitive data",
    "metadata": {
      "category": "Automation",
      "version": "1.0.0"
    },
    "mode": "All",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Audit or Disabled the execution of the Policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Automation/automationAccounts/variables"
          },
          {
            "field": "Microsoft.Automation/automationAccounts/variables/isEncrypted",
            "notEquals": "true"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylawfdadbfa5-162a-4d33-a804-c22efc03970d.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'fdadbfa5-162a-4d33-a804-c22efc03970d' {

    Properties @{
        DisplayName = 'Audit encryption of Automation account variables'
        Description = 'It is important to enable encryption of Automation account variable assets when storing sensitive data'
        Category    = 'Automation'
        Version     = '1.0.0'
        Mode        = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Audit or Disabled the execution of the Policy'
    }

    Resource 'Microsoft.Automation/automationAccounts/variables' {

        Require 'isEncrypted is true' {
            Field isEncrypted | Must -Be 'true'
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/Automation/audit-encryption-of-automation-account-variables/azurepolicy.json in Azure/Community-Policy, under the MIT licence.