Bylaw

Gallery › Security Center › Azure built-in policies

Subscriptions should have a contact email address for security issues

Converted Policy AuditIfNotExists Disabled Mode All Version 1.0.1

To ensure the relevant people in your organization are notified when there is a potential security breach in one of your subscriptions, set a security contact to receive email notifications from Security Center.

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

Azure Policy JSONASC_Security_contact_email.json · 48 lines
{
  "properties": {
    "displayName": "Subscriptions should have a contact email address for security issues",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "To ensure the relevant people in your organization are notified when there is a potential security breach in one of your subscriptions, set a security contact to receive email notifications from Security Center.",
    "metadata": {
      "version": "1.0.1",
      "category": "Security Center"
    },
    "version": "1.0.1",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Resources/subscriptions"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/securityContacts",
          "existenceCondition": {
            "field": "Microsoft.Security/securityContacts/email",
            "notEquals": ""
          }
        }
      }
    },
    "versions": [
      "1.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/4f4f78b8-e367-4b10-a341-d9a4ad5cf1c7",
  "name": "4f4f78b8-e367-4b10-a341-d9a4ad5cf1c7"
}
Bylaw4f4f78b8-e367-4b10-a341-d9a4ad5cf1c7.bylaw.ps1 · 28 lines
# Converted from ASC_Security_contact_email.json by ConvertTo-Bylaw.
Policy '4f4f78b8-e367-4b10-a341-d9a4ad5cf1c7' {

    Properties @{
        DisplayName   = 'Subscriptions should have a contact email address for security issues'
        Description   = 'To ensure the relevant people in your organization are notified when there is a potential security breach in one of your subscriptions, set a security contact to receive email notifications from Security Center.'
        Version       = '1.0.1'
        Category      = 'Security Center'
        PolicyVersion = '1.0.1'
        Mode          = 'All'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'AuditIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Resources/subscriptions'

    AuditIfNotExists 'Microsoft.Security/securityContacts' -Effect (Param Effect) {
        Require 'email is not' {
            Field email | Must -Not -Be '' -IfPresent
        }
    }
}

Source: built-in-policies/policyDefinitions/Security Center/ASC_Security_contact_email.json in Azure/azure-policy, under the MIT licence.