---
policy: /ce/ca/azure/subscription/security-alert-notifications-to-subscription-owners
logic: /ce/ca/azure/subscription/security-alert-notifications-to-subscription-owners/prod.logic.yaml
executionTime: 2025-04-24T23:46:27.72337772Z
rows:
  - id: test1
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner')
        && extract('caJsonQueryText__securityCenterContacts_default_state__c') ==
        'On'
      actual: extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner')
        && extract('caJsonQueryText__securityCenterContacts_default_state__c') ==
        'On'
    runtimeError: {}
  - id: test2
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner')
        && extract('caJsonQueryText__securityCenterContacts_default_state__c') ==
        'On'
      actual: extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner')
        && extract('caJsonQueryText__securityCenterContacts_default_state__c') ==
        'On'
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test4
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test5
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test6
    match: true
    status:
      expected: UNDETERMINED
      actual: UNDETERMINED
    conditionIndex:
      expected: 103
      actual: 103
    conditionText:
      expected: extract('CA10__securityCenterContacts__c').asJson().isInvalid()
      actual: extract('CA10__securityCenterContacts__c').asJson().isInvalid()
    runtimeError:
      expected: "Expected property name or '}' in JSON at position 1 (line 1 column\
        \ 2)"
      actual: "Expected property name or '}' in JSON at position 1 (line 1 column\
        \ 2)"
  - id: test7
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner')
        && extract('caJsonQueryText__securityCenterContacts_default_state__c') ==
        'On'
      actual: extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner')
        && extract('caJsonQueryText__securityCenterContacts_default_state__c') ==
        'On'
    runtimeError: {}
  - id: test8
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test9
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/azure/subscription/security-alert-notifications-to-subscription-owners/policy.yaml
    md5Hash: 0C45AAF28A9F5072167346906142A647
    content: |
      ---
      names:
        full: Azure Subscription Security Alert Notifications to subscription owners are
          not configured
        contextual: Security Alert Notifications to subscription owners are not configured
      description: Enable security alert emails to subscription owners.
      type: COMPLIANCE_POLICY
      categories:
        - SECURITY
      frameworkMappings:
        - "/frameworks/cis-azure-v2.1.0/02/01/17"
        - "/frameworks/cis-azure-v3.0.0/03/01/12"
        - "/frameworks/cloudaware/resource-security/microsoft-defender-configuration"
      similarPolicies:
        internal:
          - dec-x-351e376f
        cloudConformity:
          - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/azure/SecurityCenter/email-to-subscription-owners.html
            name: Email To Subscription Owners
  - path: /ce/ca/azure/subscription/security-alert-notifications-to-subscription-owners/prod.logic.yaml
    md5Hash: 10A75F08D225D53D47802BA20A41F682
    content: |-
      ---
      inputType: "CA10__CaAzureAccount__c"
      testData:
        - file: "test-data.json"
      importExtracts:
        - file: "/types/CA10__CaAzureAccount__c/object.extracts.yaml"
      conditions:
        - status: "COMPLIANT"
          currentStateMessage: "Security alert emails to subscription owners are enabled."
      # Extracts only for the default contact
          check:
            AND:
              args:
                - CONTAINS:
                    arg:
                      EXTRACT: "caJsonQueryBoolean__securityCenterContacts_default_roles__c"
                    substring:
                      TEXT: "Owner"
                - IS_EQUAL:
                    left:
                      EXTRACT: "caJsonQueryText__securityCenterContacts_default_state__c"
                    right:
                      TEXT: "On"
      otherwise:
        status: "INCOMPLIANT"
        currentStateMessage: "Security alert emails to subscription owners are not enabled."
        remediationMessage: "Consider enabling security alert emails to subscription owners."
  - path: /ce/ca/azure/subscription/security-alert-notifications-to-subscription-owners/test-data.json
    md5Hash: C66917ED26146B2983B468421AD1AFFC
    content: |-
      [
          {
              "expectedResult": {
                  "status": "COMPLIANT",
                  "conditionIndex": "199",
                  "conditionText": "extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner') && extract('caJsonQueryText__securityCenterContacts_default_state__c') == 'On'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test1",
              "CA10__securityCenterContacts__c": "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"Owner\"}]"
          },
          {
              "expectedResult": {
                  "status": "COMPLIANT",
                  "conditionIndex": "199",
                  "conditionText": "extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner') && extract('caJsonQueryText__securityCenterContacts_default_state__c') == 'On'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test2",
              "CA10__securityCenterContacts__c": "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"Owner, Contributor, ServiceAdmin\"}]"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "200",
                  "conditionText": "otherwise",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test3",
              "CA10__securityCenterContacts__c": "[]"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "200",
                  "conditionText": "otherwise",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test4",
              "CA10__securityCenterContacts__c": "[{\"name\":\"default\",\"notificationsByRoleState\":\"Off\",\"notificationsByRoleRoles\":\"Owner, Contributor, ServiceAdmin\"}]"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "200",
                  "conditionText": "otherwise",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test5",
              "CA10__securityCenterContacts__c": "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"Contributor, ServiceAdmin\"}]"
          },
          {
              "expectedResult": {
                  "status": "UNDETERMINED",
                  "conditionIndex": "103",
                  "conditionText": "extract('CA10__securityCenterContacts__c').asJson().isInvalid()",
                  "runtimeError": "Expected property name or '}' in JSON at position 1 (line 1 column 2)"
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test6",
              "CA10__securityCenterContacts__c": "{"
          },
          {
              "expectedResult": {
                  "status": "COMPLIANT",
                  "conditionIndex": "199",
                  "conditionText": "extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner') && extract('caJsonQueryText__securityCenterContacts_default_state__c') == 'On'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test7",
              "CA10__securityCenterContacts__c": "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"owner, contributor, serviceadmin\"}]"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "200",
                  "conditionText": "otherwise",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test8",
              "CA10__securityCenterContacts__c": "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\"}]"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "200",
                  "conditionText": "otherwise",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-06-11T13:19:33Z"
              },
              "Id": "test9",
              "CA10__securityCenterContacts__c": "[{\"name\":\"default\",\"notificationsByRoleRoles\":\"Owner, Contributor, ServiceAdmin\"}]"
          }
      ]
  - path: /types/CA10__CaAzureAccount__c/object.extracts.yaml
    md5Hash: 9C78116D7D6EA5327842D3BC5DCF8980
    content: "---\nextracts:\n# Not Nullable.\n  - name: \"CA10__availableLocationNames__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__availableLocationNames__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__availableLocationNames__c\"\n            currentStateMessage: \"Unable\
      \ to determine Subscription Available Locations. Possible permission issue withMicrosoft.Resources/subscriptions/locations/read\"\
      \n  - name: \"caJsonFrom_availableLocationNames__c\"\n    value:\n      JSON_FROM:\n\
      \        arg:\n          EXTRACT: \"CA10__availableLocationNames__c\"\n    \
      \    undeterminedIf:\n          isInvalid: \"Subscription Available Locations\
      \ JSON is invalid.\"\n  - name: \"CA10__subscriptionId__c\"\n    value: \n \
      \     FIELD:\n        path: \"CA10__subscriptionId__c\"\n        undeterminedIf:\n\
      \          isEmpty: \"Corrupted data. Subscription ID cannot be empty.\"\n#\
      \ Not Nullable\n  - name: \"CA10__securityCenterAutoProvisioning__c\"\n    value:\
      \ \n      FIELD:\n        path: \"CA10__securityCenterAutoProvisioning__c\"\n\
      \        returnType: BYTES\n        undeterminedIf:\n          noAccessDelegate:\n\
      \            path: \"CA10__securityCenterAutoProvisioning__c\"\n           \
      \ currentStateMessage: \"Unable to determine Auto Provisioning Settings. Possible\
      \ permission issue with Microsoft.Security/autoProvisioningSettings\" \n# Not\
      \ Nullable\n  - name: \"CA10__securityCenterContacts__c\"\n    value: \n   \
      \   FIELD:\n        path: \"CA10__securityCenterContacts__c\"\n        returnType:\
      \ BYTES\n        undeterminedIf:\n          noAccessDelegate:\n            path:\
      \ \"CA10__securityCenterContacts__c\"\n            currentStateMessage: \"Unable\
      \ to determine Security Contacts. Possible permission issue with Microsoft.Security/securityContacts\"\
      \ \n  - name: \"caJsonFrom__securityCenterContacts__c\"\n    value: \n     \
      \ JSON_FROM:\n        arg: \n          EXTRACT: \"CA10__securityCenterContacts__c\"\
      \n        undeterminedIf:\n          isInvalid: \"Security Center Contacts JSON\
      \ is invalid.\"\n          isEmpty: \"Unable to determine Security Contacts.\
      \ Possible permission issue with Microsoft.Security/securityContacts\"\n# Security\
      \ Center: Contacts properties.notificationsByRole roles for the default contact\n\
      # notificationsByRoleRoles is a string that contains roles separated by comma\n\
      # Values: AccountAdmin, Contributor, Owner, ServiceAdmin.\n  - name: \"caJsonQueryBoolean__securityCenterContacts_default_roles__c\"\
      \n    value: \n      JSON_QUERY_TEXT:\n        arg: \n          EXTRACT: \"\
      caJsonFrom__securityCenterContacts__c\"\n        expression: \"to_string([?\
      \ name == 'default'].notificationsByRoleRoles | [0])\"\n        undeterminedIf:\
      \ \n          evaluationError: \"The JSON query has failed.\"\n          resultTypeMismatch:\
      \ \"The JSON query did not return text type.\"\n# Security Center: Contacts\
      \ properties.notificationsByRole state for the default contact\n# Values: On,\
      \ Off.\n  - name: \"caJsonQueryText__securityCenterContacts_default_state__c\"\
      \n    value: \n      JSON_QUERY_TEXT:\n        arg: \n          EXTRACT: \"\
      caJsonFrom__securityCenterContacts__c\"\n        expression: \"[? name == 'default'].notificationsByRoleState\
      \ | [0]\"\n        undeterminedIf: \n          evaluationError: \"The JSON query\
      \ has failed.\"\n          resultTypeMismatch: \"The JSON query did not return\
      \ text type.\"\n# Security Center: Contacts email for the default contact\n\
      # email is a string that contains values separated by comma\n  - name: \"caJsonQueryText__securityCenterContacts_default_email__c\"\
      \n    value: \n      JSON_QUERY_TEXT:\n        arg: \n          EXTRACT: \"\
      caJsonFrom__securityCenterContacts__c\"\n        expression: \"[? name == 'default'\
      \ && email != ''].email | [0]\"\n        undeterminedIf: \n          evaluationError:\
      \ \"The JSON query has failed.\"\n          resultTypeMismatch: \"The JSON query\
      \ did not return text type.\"\n# Values: On, Off.\n  - name: \"caJsonQueryText__securityCenterContacts_default_alert_notifications__c\"\
      \n    value: \n      JSON_QUERY_TEXT:\n        arg: \n          EXTRACT: \"\
      caJsonFrom__securityCenterContacts__c\"\n        expression: \"[? name == 'default'].alertNotifications\
      \ | [0]\"\n        undeterminedIf: \n          evaluationError: \"The JSON query\
      \ has failed.\"\n          resultTypeMismatch: \"The JSON query did not return\
      \ text type.\"\n# Values: High, Medium, Low.\n  - name: \"caJsonQueryText__securityCenterContacts_default_alert_notifications_severity__c\"\
      \n    value: \n      JSON_QUERY_TEXT:\n        arg: \n          EXTRACT: \"\
      caJsonFrom__securityCenterContacts__c\"\n        expression: \"[? name == 'default'].alertNotificationsMinimalSeverity\
      \ | [0]\"\n        undeterminedIf: \n          evaluationError: \"The JSON query\
      \ has failed.\"\n          resultTypeMismatch: \"The JSON query did not return\
      \ text type.\"\n# Not Nullable\n  - name: \"CA10__defenderForCloudSettingsJson__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__defenderForCloudSettingsJson__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__defenderForCloudSettingsJson__c\"\n            currentStateMessage: \"\
      Unable to determine Microsoft Defender for Cloud Settings. Possible permission\
      \ issue with Microsoft.Security/settings\" \n  - name: \"caJsonFrom__defenderForCloudSettings__c\"\
      \n    value: \n      JSON_FROM:\n        arg: \n          EXTRACT: \"CA10__defenderForCloudSettingsJson__c\"\
      \n        undeterminedIf:\n          isInvalid: \"Security Center Contacts JSON\
      \ is invalid.\"\n          isEmpty: \"Unable to determine Security Contacts.\
      \ Possible permission issue with Microsoft.Security/settings\""
script: |-
  CREATE TEMP FUNCTION mock_ExpectedResult()
  RETURNS ARRAY<STRUCT<
          Id STRING,
          expectedResult STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, runtimeError STRING>
      >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "Id" : "test1",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner') && extract('caJsonQueryText__securityCenterContacts_default_state__c') == 'On'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test2",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner') && extract('caJsonQueryText__securityCenterContacts_default_state__c') == 'On'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "test5",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "test6",
    "expectedResult" : {
      "status" : "UNDETERMINED",
      "conditionIndex" : "103",
      "conditionText" : "extract('CA10__securityCenterContacts__c').asJson().isInvalid()",
      "runtimeError" : "Expected property name or '}' in JSON at position 1 (line 1 column 2)"
    }
  }, {
    "Id" : "test7",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner') && extract('caJsonQueryText__securityCenterContacts_default_state__c') == 'On'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test8",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "test9",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAzureAccount__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      CA10__securityCenterContacts__c STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test1",
    "CA10__securityCenterContacts__c" : "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"Owner\"}]"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test2",
    "CA10__securityCenterContacts__c" : "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"Owner, Contributor, ServiceAdmin\"}]"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test3",
    "CA10__securityCenterContacts__c" : "[]"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test4",
    "CA10__securityCenterContacts__c" : "[{\"name\":\"default\",\"notificationsByRoleState\":\"Off\",\"notificationsByRoleRoles\":\"Owner, Contributor, ServiceAdmin\"}]"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test5",
    "CA10__securityCenterContacts__c" : "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"Contributor, ServiceAdmin\"}]"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test6",
    "CA10__securityCenterContacts__c" : "{"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test7",
    "CA10__securityCenterContacts__c" : "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\",\"notificationsByRoleRoles\":\"owner, contributor, serviceadmin\"}]"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test8",
    "CA10__securityCenterContacts__c" : "[{\"name\":\"default\",\"notificationsByRoleState\":\"On\"}]"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-11T13:19:33Z")
    },
    "Id" : "test9",
    "CA10__securityCenterContacts__c" : "[{\"name\":\"default\",\"notificationsByRoleRoles\":\"Owner, Contributor, ServiceAdmin\"}]"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAzureAccount__c(
      obj STRUCT<
          Id STRING,
          CA10__securityCenterContacts__c STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  OPTIONS (library=['gs://compliance-platform-public/jmespath.min.js'])
  AS r"""
      var TextLib = new function () {
          this.normalize = function(arg) {
              return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase();
          };
          this.isEmpty = function(arg) {
              return this.normalize(arg) == '';
          };
          this.isNotEmpty = function(arg) {
              return this.normalize(arg) != '';
          };
          this.equal = function(left, right) {
              return this.normalize(left) == this.normalize(right);
          };
          this.notEqual = function(left, right) {
              return this.normalize(left) != this.normalize(right);
          };
          this.startsWith = function(arg, substring) {
              return this.normalize(arg).startsWith(this.normalize(substring));
          };
          this.endsWith = function(arg, substring) {
              return this.normalize(arg).endsWith(this.normalize(substring));
          };
          this.contains = function(arg, substring) {
              return this.normalize(arg).includes(this.normalize(substring));
          };
      }();
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      if (false) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared()", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[1], conditionIndex:[100..199]
      function jsonQueryChecked4() {
          var input = extract6.call(extract6);
          var out;
          try {
              out = jmespath.search(input, 'to_string([? name == \'default\'].notificationsByRoleRoles | [0])');
          if (out != null && typeof out != 'string') {
              throw new Error("UNDETERMINED condition:104", {cause: {status: 'UNDETERMINED', conditionIndex: 104, conditionText: "extract('caJsonFrom__securityCenterContacts__c').jsonQueryText('to_string([? name == \\'default\\'].notificationsByRoleRoles | [0])').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return text type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          } catch (e) {
              throw new Error("UNDETERMINED condition:105", {cause: {status: 'UNDETERMINED', conditionIndex: 105, conditionText: "extract('caJsonFrom__securityCenterContacts__c').jsonQueryText('to_string([? name == \\'default\\'].notificationsByRoleRoles | [0])').isEvaluationFailed()", currentStateMessage: "The JSON query has failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}});
          }
          return out;
      }
      function jsonChecked7() {
          var input = extract9.call(extract9);
          if (TextLib.isEmpty(input)) {
              throw new Error("UNDETERMINED condition:102", {cause: {status: 'UNDETERMINED', conditionIndex: 102, conditionText: "extract('CA10__securityCenterContacts__c').asJson().isEmpty()", currentStateMessage: "Unable to determine Security Contacts. Possible permission issue with Microsoft.Security/securityContacts", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          var out;
          try {
              out = JSON.parse(input);
          } catch (e) {
              throw new Error("UNDETERMINED condition:103", {cause: {status: 'UNDETERMINED', conditionIndex: 103, conditionText: "extract('CA10__securityCenterContacts__c').asJson().isInvalid()", currentStateMessage: "Security Center Contacts JSON is invalid.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}});
          }
          return out;
      }
      function fieldChecked10() {
          if ((obj.CA10__securityCenterContacts__c == null || obj.CA10__securityCenterContacts__c == '')) {
              throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__securityCenterContacts__c.delegatedTo(CA10__securityCenterContacts__c).isEmpty()", currentStateMessage: "Unable to determine Security Contacts. Possible permission issue with Microsoft.Security/securityContacts", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__securityCenterContacts__c;
      }
      function extract9() { if (!this.out) { this.out = fieldChecked10(); } return this.out; };
      function extract6() { if (!this.out) { this.out = jsonChecked7(); } return this.out; };
      function extract3() { if (!this.out) { this.out = jsonQueryChecked4(); } return this.out; };
      function jsonQueryChecked14() {
          var input = extract6.call(extract6);
          var out;
          try {
              out = jmespath.search(input, '[? name == \'default\'].notificationsByRoleState | [0]');
          if (out != null && typeof out != 'string') {
              throw new Error("UNDETERMINED condition:106", {cause: {status: 'UNDETERMINED', conditionIndex: 106, conditionText: "extract('caJsonFrom__securityCenterContacts__c').jsonQueryText('[? name == \\'default\\'].notificationsByRoleState | [0]').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return text type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          } catch (e) {
              throw new Error("UNDETERMINED condition:107", {cause: {status: 'UNDETERMINED', conditionIndex: 107, conditionText: "extract('caJsonFrom__securityCenterContacts__c').jsonQueryText('[? name == \\'default\\'].notificationsByRoleState | [0]').isEvaluationFailed()", currentStateMessage: "The JSON query has failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}});
          }
          return out;
      }
      function extract13() { if (!this.out) { this.out = jsonQueryChecked14(); } return this.out; };
      references1.push('Security Center: Contacts [obj.CA10__securityCenterContacts__c]: ' + obj.CA10__securityCenterContacts__c);
      try {
          if (TextLib.contains(extract3.call(extract3), 'Owner') && TextLib.equal(extract13.call(extract13), 'On')) {
              return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "extract('caJsonQueryBoolean__securityCenterContacts_default_roles__c').contains('Owner') && extract('caJsonQueryText__securityCenterContacts_default_state__c') == 'On'", currentStateMessage: "Security alert emails to subscription owners are enabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      return {status: 'INCOMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "Security alert emails to subscription owners are not enabled.", currentStateReferences: references1.join('\n'), remediation: "Consider enabling security alert emails to subscription owners.", runtimeError: null};
  """;


  SELECT
    expectedResult.Id as Id,
    IF (
      IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '')
      AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1)
      AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '')
      AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''),
      "MATCH",
      "FAIL"
    ) as match,
    expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus,
    expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex,
    expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText,
    expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError
  FROM UNNEST(mock_ExpectedResult()) expectedResult
  LEFT JOIN (
      SELECT
          sObject.Id AS Id,
          sObject.CA10__securityCenterContacts__c AS CA10__securityCenterContacts__c,
          process_CA10__CaAzureAccount__c(
              STRUCT(
                  sObject.Id AS Id,
                  sObject.CA10__securityCenterContacts__c AS CA10__securityCenterContacts__c
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAzureAccount__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
