---
policy: /ce/ca/azure/virtual-machine/disable-managed-disk-public-network-access
logic: /ce/ca/azure/virtual-machine/disable-managed-disk-public-network-access/prod.logic.yaml
executionTime: 2025-04-24T23:46:28.460406727Z
rows:
  - id: test1
    match: true
    status:
      expected: DISAPPEARED
      actual: DISAPPEARED
    conditionIndex:
      expected: 99
      actual: 99
    conditionText:
      expected: isDisappeared(CA10__disappearanceTime__c)
      actual: isDisappeared(CA10__disappearanceTime__c)
    runtimeError: {}
  - id: test2
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__networkAccessPolicy__c') == 'AllowAll' && extract('CA10__publicNetworkAccess__c')
        == 'Enabled'
      actual: extract('CA10__networkAccessPolicy__c') == 'AllowAll' && extract('CA10__publicNetworkAccess__c')
        == 'Enabled'
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10__publicNetworkAccess__c') != 'Disabled'
      actual: extract('CA10__publicNetworkAccess__c') != 'Disabled'
    runtimeError: {}
  - id: test4
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10__publicNetworkAccess__c') != 'Disabled'
      actual: extract('CA10__publicNetworkAccess__c') != 'Disabled'
    runtimeError: {}
  - id: test5
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 399
      actual: 399
    conditionText:
      expected: extract('CA10__networkAccessPolicy__c') == 'AllowAll'
      actual: extract('CA10__networkAccessPolicy__c') == 'AllowAll'
    runtimeError: {}
  - id: test6
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: (extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c')
        == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'
      actual: (extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c')
        == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'
    runtimeError: {}
  - id: test7
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: (extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c')
        == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'
      actual: (extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c')
        == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'
    runtimeError: {}
usedFiles:
  - path: /ce/ca/azure/virtual-machine/disable-managed-disk-public-network-access/policy.yaml
    md5Hash: AFF0987D241199C8604463D76E1E6953
    content: "---\nnames:\n  full: Azure Managed Disk Public Network Access is not\
      \ disabled\n  contextual: Managed Disk Public Network Access is not disabled\n\
      description: >\n  The setting 'Enable public access from all networks' is, in\
      \ many cases, an overly permissive \n  setting on Virtual Machine Disks that\
      \ presents atypical attack, data infiltration, and \n  data exfiltration vectors.\
      \ If a disk to network connection is required, the preferred \n  setup is to\
      \ disable public access and enable private access.\ntype: COMPLIANCE_POLICY\n\
      categories:\n  - SECURITY\nframeworkMappings:\n  - \"/frameworks/cis-azure-v3.0.0/08/05\"\
      \n  - \"/frameworks/cloudaware/resource-security/public-and-anonymous-access\"\
      \nsimilarPolicies:\n  internal:\n    - dec-x-b17c005c"
  - path: /ce/ca/azure/virtual-machine/disable-managed-disk-public-network-access/prod.logic.yaml
    md5Hash: DAD10E42E92037AF4E56EC7DD5426482
    content: "---\ninputType: \"CA10__CaAzureManagedDisk__c\"\nimportExtracts:\n \
      \ - file: \"/types/CA10__CaAzureManagedDisk__c/object.extracts.yaml\"\ntestData:\n\
      \  - file: \"test-data.json\"\nconditions:\n  - status: \"INCOMPLIANT\"\n  \
      \  currentStateMessage: \"The Managed Disk data is publicly accessible on the\
      \ internet \n      and can be exported or uploaded to from any network.\"\n\
      \    remediationMessage: \"Consider restricting the Managed Disk Public Access.\"\
      \n    check:\n      AND:\n        args:\n        - IS_EQUAL:\n            left:\n\
      \              EXTRACT: \"CA10__networkAccessPolicy__c\"\n            right:\n\
      \              TEXT: \"AllowAll\"\n        - IS_EQUAL:\n            left:\n\
      \              EXTRACT: \"CA10__publicNetworkAccess__c\"\n            right:\n\
      \              TEXT: \"Enabled\"\n  - status: \"INCOMPLIANT\"\n    currentStateMessage:\
      \ \"The Managed Disk Public Access is not disabled.\"\n    remediationMessage:\
      \ \"Consider disabling the Managed Disk Public Access.\"\n    check:\n     \
      \ NOT_EQUAL:\n        left:\n          EXTRACT: \"CA10__publicNetworkAccess__c\"\
      \n        right:\n          TEXT: \"Disabled\"\n  - status: \"INCOMPLIANT\"\n\
      \    currentStateMessage: \"The Managed Disk Network Access Policy allows access\
      \ from any network.\"\n    remediationMessage: \"Consider restricting the Managed\
      \ Disk Network Access Policy.\"\n    check:\n      IS_EQUAL:\n        left:\n\
      \          EXTRACT: \"CA10__networkAccessPolicy__c\"\n        right:\n     \
      \     TEXT: \"AllowAll\"\n  - status: \"COMPLIANT\"\n    currentStateMessage:\
      \ \"The Managed Disk Public Access is restricted.\"\n    check:\n      AND:\n\
      \        args:\n          - OR:\n              args:\n                - IS_EQUAL:\n\
      \                    left:\n                      EXTRACT: \"CA10__networkAccessPolicy__c\"\
      \n                    right:\n                      TEXT: \"AllowPrivate\"\n\
      \                - IS_EQUAL:\n                    left:\n                  \
      \    EXTRACT: \"CA10__networkAccessPolicy__c\"\n                    right:\n\
      \                      TEXT: \"DenyAll\"\n          - IS_EQUAL:\n          \
      \    left:\n                EXTRACT: \"CA10__publicNetworkAccess__c\"\n    \
      \          right:\n                TEXT: \"Disabled\"\notherwise:\n  status:\
      \ \"UNDETERMINED\"\n  currentStateMessage: \"Unexpected value in the fields.\"\
      \n"
  - path: /types/CA10__CaAzureManagedDisk__c/object.extracts.yaml
    md5Hash: F0194C2E5818080A00E360A4D0FC7075
    content: "---\nextracts:\n# Values: Succeeded, Deploying, Canceled, Failed. Not\
      \ Nullable. Can't have no access, retrieved via Microsoft.Compute/disks\n  -\
      \ name: \"CA10__provisioningState__c\"\n    value: \n      FIELD:\n        path:\
      \ \"CA10__provisioningState__c\"\n        undeterminedIf:\n          isEmpty:\
      \ \"Corrupted data. Provisioning State cannot be empty.\"\n# Values: ActiveSAS,\
      \ ActiveSASFrozen, ActiveUpload, Attached, Frozen, ReadyToUpload, Reserved,\
      \ Unattached. Not Nullable. Can't have no access, retrieved via Microsoft.Compute/disks\n\
      \  - name: \"CA10__diskState__c\"\n    value: \n      FIELD:\n        path:\
      \ \"CA10__diskState__c\"\n        undeterminedIf:\n          isEmpty: \"Corrupted\
      \ data. Disk State cannot be empty.\"\n# Values: ENCRYPTIONATRESTWITHPLATFORMKEY,\
      \ ENCRYPTIONATRESTWITHCUSTOMERKEY, ENCRYPTIONATRESTWITHPLATFORMANDCUSTOMERKEYS.\n\
      \  - name: \"CA10__encryptionType__c\"\n    value: \n      FIELD:\n        path:\
      \ \"CA10__encryptionType__c\"\n        undeterminedIf:\n          isEmpty: \"\
      Corrupted data. Encryption Type cannot be empty.\"\n# Values: Enabled, Disabled.\
      \ Not Nullable. Can't have no access, retrieved via Microsoft.Compute/disks\n\
      \  - name: \"CA10__publicNetworkAccess__c\"\n    value: \n      FIELD:\n   \
      \     path: \"CA10__publicNetworkAccess__c\"\n        undeterminedIf:\n    \
      \      isEmpty: \"Corrupted data. Public Network Access cannot be empty.\"\n\
      # Values: AllowAll, AllowPrivate, DenyAll. Not Nullable. Can't have no access,\
      \ retrieved via Microsoft.Compute/disks\n  - name: \"CA10__networkAccessPolicy__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__networkAccessPolicy__c\"\n\
      \        undeterminedIf:\n          isEmpty: \"Corrupted data. Public Network\
      \ Access cannot be empty.\"\n# Values: AzureActiveDirectory, None. Nullable\
      \ (which equals none). Can't have no access, retrieved via Microsoft.Compute/disks\n\
      \  - name: \"CA10__dataAccessAuthMode__c\"\n    value: \n      FIELD:\n    \
      \    path: \"CA10__dataAccessAuthMode__c\"\n"
  - path: /ce/ca/azure/virtual-machine/disable-managed-disk-public-network-access/test-data.json
    md5Hash: 09478C3E3C6F9ACDB8111725F8CF17B3
    content: |-
      [
          {
              "expectedResult": {
                  "status": "DISAPPEARED",
                  "conditionIndex": "99",
                  "conditionText": "isDisappeared(CA10__disappearanceTime__c)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-10-02T04:03:26Z"
              },
              "Id": "test1",
              "CA10__disappearanceTime__c": "2024-09-17T15:10:24Z",
              "CA10__networkAccessPolicy__c": "AllowAll",
              "CA10__publicNetworkAccess__c": "Enabled"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "199",
                  "conditionText": "extract('CA10__networkAccessPolicy__c') == 'AllowAll' && extract('CA10__publicNetworkAccess__c') == 'Enabled'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-10-02T04:03:26Z"
              },
              "Id": "test2",
              "CA10__disappearanceTime__c": null,
              "CA10__networkAccessPolicy__c": "AllowAll",
              "CA10__publicNetworkAccess__c": "Enabled"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "299",
                  "conditionText": "extract('CA10__publicNetworkAccess__c') != 'Disabled'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-10-02T04:03:26Z"
              },
              "Id": "test3",
              "CA10__disappearanceTime__c": null,
              "CA10__networkAccessPolicy__c": "DenyAll",
              "CA10__publicNetworkAccess__c": "Enabled"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "299",
                  "conditionText": "extract('CA10__publicNetworkAccess__c') != 'Disabled'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-10-02T04:03:26Z"
              },
              "Id": "test4",
              "CA10__disappearanceTime__c": null,
              "CA10__networkAccessPolicy__c": "AllowPrivate",
              "CA10__publicNetworkAccess__c": "Enabled"
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "399",
                  "conditionText": "extract('CA10__networkAccessPolicy__c') == 'AllowAll'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-10-02T04:03:26Z"
              },
              "Id": "test5",
              "CA10__disappearanceTime__c": null,
              "CA10__networkAccessPolicy__c": "AllowAll",
              "CA10__publicNetworkAccess__c": "Disabled"
          },
          {
              "expectedResult": {
                  "status": "COMPLIANT",
                  "conditionIndex": "499",
                  "conditionText": "(extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c') == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-10-02T04:03:26Z"
              },
              "Id": "test6",
              "CA10__disappearanceTime__c": null,
              "CA10__networkAccessPolicy__c": "DenyAll",
              "CA10__publicNetworkAccess__c": "Disabled"
          },
          {
              "expectedResult": {
                  "status": "COMPLIANT",
                  "conditionIndex": "499",
                  "conditionText": "(extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c') == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2024-10-02T04:03:26Z"
              },
              "Id": "test7",
              "CA10__disappearanceTime__c": null,
              "CA10__networkAccessPolicy__c": "AllowPrivate",
              "CA10__publicNetworkAccess__c": "Disabled"
          }
      ]
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" : "DISAPPEARED",
      "conditionIndex" : "99",
      "conditionText" : "isDisappeared(CA10__disappearanceTime__c)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test2",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__networkAccessPolicy__c') == 'AllowAll' && extract('CA10__publicNetworkAccess__c') == 'Enabled'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "299",
      "conditionText" : "extract('CA10__publicNetworkAccess__c') != 'Disabled'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "299",
      "conditionText" : "extract('CA10__publicNetworkAccess__c') != 'Disabled'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test5",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "399",
      "conditionText" : "extract('CA10__networkAccessPolicy__c') == 'AllowAll'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test6",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "499",
      "conditionText" : "(extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c') == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test7",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "499",
      "conditionText" : "(extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c') == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAzureManagedDisk__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__networkAccessPolicy__c STRING,
      CA10__publicNetworkAccess__c STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2024-10-02T04:03:26Z")
    },
    "Id" : "test1",
    "CA10__disappearanceTime__c" : new Date("2024-09-17T15:10:24Z"),
    "CA10__networkAccessPolicy__c" : "AllowAll",
    "CA10__publicNetworkAccess__c" : "Enabled"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-10-02T04:03:26Z")
    },
    "Id" : "test2",
    "CA10__networkAccessPolicy__c" : "AllowAll",
    "CA10__publicNetworkAccess__c" : "Enabled"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-10-02T04:03:26Z")
    },
    "Id" : "test3",
    "CA10__networkAccessPolicy__c" : "DenyAll",
    "CA10__publicNetworkAccess__c" : "Enabled"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-10-02T04:03:26Z")
    },
    "Id" : "test4",
    "CA10__networkAccessPolicy__c" : "AllowPrivate",
    "CA10__publicNetworkAccess__c" : "Enabled"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-10-02T04:03:26Z")
    },
    "Id" : "test5",
    "CA10__networkAccessPolicy__c" : "AllowAll",
    "CA10__publicNetworkAccess__c" : "Disabled"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-10-02T04:03:26Z")
    },
    "Id" : "test6",
    "CA10__networkAccessPolicy__c" : "DenyAll",
    "CA10__publicNetworkAccess__c" : "Disabled"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-10-02T04:03:26Z")
    },
    "Id" : "test7",
    "CA10__networkAccessPolicy__c" : "AllowPrivate",
    "CA10__publicNetworkAccess__c" : "Disabled"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAzureManagedDisk__c(
      obj STRUCT<
          Id STRING,
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__networkAccessPolicy__c STRING,
          CA10__publicNetworkAccess__c STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE 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]
      references1.push('Deleted From Azure [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c);
      if (obj.CA10__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[1], conditionIndex:[100..199]
      function fieldChecked4() {
          if (TextLib.isEmpty(obj.CA10__networkAccessPolicy__c)) {
              throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__networkAccessPolicy__c.isEmpty()", currentStateMessage: "Corrupted data. Public Network Access cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__networkAccessPolicy__c;
      }
      function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; };
      function fieldChecked7() {
          if (TextLib.isEmpty(obj.CA10__publicNetworkAccess__c)) {
              throw new Error("UNDETERMINED condition:102", {cause: {status: 'UNDETERMINED', conditionIndex: 102, conditionText: "CA10__publicNetworkAccess__c.isEmpty()", currentStateMessage: "Corrupted data. Public Network Access cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__publicNetworkAccess__c;
      }
      function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; };
      references1.push('Network Access Policy [obj.CA10__networkAccessPolicy__c]: ' + obj.CA10__networkAccessPolicy__c);
      references1.push('Public Network Access [obj.CA10__publicNetworkAccess__c]: ' + obj.CA10__publicNetworkAccess__c);
      try {
          if (TextLib.equal(extract3.call(extract3), 'AllowAll') && TextLib.equal(extract6.call(extract6), 'Enabled')) {
              return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__networkAccessPolicy__c') == 'AllowAll' && extract('CA10__publicNetworkAccess__c') == 'Enabled'", currentStateMessage: "The Managed Disk data is publicly accessible on the internet and can be exported or uploaded to from any network.", currentStateReferences: references1.join('\n'), remediation: "Consider restricting the Managed Disk Public Access.", runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      // condition[2], conditionIndex:[200..299]
      function fieldChecked10() {
          if (TextLib.isEmpty(obj.CA10__publicNetworkAccess__c)) {
              throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__publicNetworkAccess__c.isEmpty()", currentStateMessage: "Corrupted data. Public Network Access cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__publicNetworkAccess__c;
      }
      function extract9() { if (!this.out) { this.out = fieldChecked10(); } return this.out; };
      try {
          if (TextLib.notEqual(extract9.call(extract9), 'Disabled')) {
              return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__publicNetworkAccess__c') != 'Disabled'", currentStateMessage: "The Managed Disk Public Access is not disabled.", currentStateReferences: references1.join('\n'), remediation: "Consider disabling the Managed Disk Public Access.", runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      // condition[3], conditionIndex:[300..399]
      function fieldChecked13() {
          if (TextLib.isEmpty(obj.CA10__networkAccessPolicy__c)) {
              throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "CA10__networkAccessPolicy__c.isEmpty()", currentStateMessage: "Corrupted data. Public Network Access cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__networkAccessPolicy__c;
      }
      function extract12() { if (!this.out) { this.out = fieldChecked13(); } return this.out; };
      try {
          if (TextLib.equal(extract12.call(extract12), 'AllowAll')) {
              return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__networkAccessPolicy__c') == 'AllowAll'", currentStateMessage: "The Managed Disk Network Access Policy allows access from any network.", currentStateReferences: references1.join('\n'), remediation: "Consider restricting the Managed Disk Network Access Policy.", runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      // condition[4], conditionIndex:[400..499]
      function fieldChecked16() {
          if (TextLib.isEmpty(obj.CA10__networkAccessPolicy__c)) {
              throw new Error("UNDETERMINED condition:401", {cause: {status: 'UNDETERMINED', conditionIndex: 401, conditionText: "CA10__networkAccessPolicy__c.isEmpty()", currentStateMessage: "Corrupted data. Public Network Access cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__networkAccessPolicy__c;
      }
      function extract15() { if (!this.out) { this.out = fieldChecked16(); } return this.out; };
      function fieldChecked20() {
          if (TextLib.isEmpty(obj.CA10__publicNetworkAccess__c)) {
              throw new Error("UNDETERMINED condition:402", {cause: {status: 'UNDETERMINED', conditionIndex: 402, conditionText: "CA10__publicNetworkAccess__c.isEmpty()", currentStateMessage: "Corrupted data. Public Network Access cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__publicNetworkAccess__c;
      }
      function extract19() { if (!this.out) { this.out = fieldChecked20(); } return this.out; };
      try {
          if ((TextLib.equal(extract15.call(extract15), 'AllowPrivate') || TextLib.equal(extract15.call(extract15), 'DenyAll')) && TextLib.equal(extract19.call(extract19), 'Disabled')) {
              return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "(extract('CA10__networkAccessPolicy__c') == 'AllowPrivate' || extract('CA10__networkAccessPolicy__c') == 'DenyAll') && extract('CA10__publicNetworkAccess__c') == 'Disabled'", currentStateMessage: "The Managed Disk Public Access is restricted.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      return {status: 'UNDETERMINED', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "Unexpected value in the fields.", currentStateReferences: references1.join('\n'), remediation: null, 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__disappearanceTime__c AS CA10__disappearanceTime__c,
          sObject.CA10__networkAccessPolicy__c AS CA10__networkAccessPolicy__c,
          sObject.CA10__publicNetworkAccess__c AS CA10__publicNetworkAccess__c,
          process_CA10__CaAzureManagedDisk__c(
              STRUCT(
                  sObject.Id AS Id,
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__networkAccessPolicy__c AS CA10__networkAccessPolicy__c,
                  sObject.CA10__publicNetworkAccess__c AS CA10__publicNetworkAccess__c
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAzureManagedDisk__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
