---
policy: /ce/ca/azure/storage/access-key-rotation-reminders
logic: /ce/ca/azure/storage/access-key-rotation-reminders/prod.logic.yaml
executionTime: 2025-12-17T01:31:12.591388616Z
generationMs: 186
executionMs: 531
rows:
  - id: '001'
    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: '002'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__keyExpirationPeriodDays__c').isEmpty()
      actual: extract('CA10__keyExpirationPeriodDays__c').isEmpty()
    runtimeError: {}
  - id: '003'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10__keyExpirationPeriodDays__c') > number(90.0)
      actual: extract('CA10__keyExpirationPeriodDays__c') > number(90.0)
    runtimeError: {}
  - id: '004'
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 300
      actual: 300
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/azure/storage/access-key-rotation-reminders/policy.yaml
    md5Hash: EA513B870E9A7A224326501B73908987
    content: |
      ---
      names:
        full: Azure Storage Account Access Key Rotation Reminders are not enabled
        contextual: Access Key Rotation Reminders are not enabled
      description: Access Keys authenticate application access requests to data contained
        in Storage Accounts. A periodic rotation of these keys is recommended to ensure
        that potentially compromised keys cannot result in a long-term exploitable credential.
        The 'Rotation Reminder' is an automatic reminder feature for a manual procedure.
      type: COMPLIANCE_POLICY
      categories:
        - SECURITY
      frameworkMappings:
        - "/frameworks/cis-azure-v5.0.0/09/03/01/01"
        - "/frameworks/cloudaware/resource-security/secure-access"
      similarPolicies:
        internal:
          - dec-x-b6d97943
  - path: /ce/ca/azure/storage/access-key-rotation-reminders/prod.logic.yaml
    md5Hash: FAB83C6AC2A4EDDD05B233EDF9E66BAF
    content: |
      ---
      inputType: "CA10__CaAzureStorageAccount__c"
      testData:
        - file: test-data.json
      importExtracts:
        - file: /types/CA10__CaAzureStorageAccount__c/object.extracts.yaml
      conditions:
        - status: "INCOMPLIANT"
          currentStateMessage: "Key rotation reminders are not configured."
          remediationMessage: "Configure the Key rotation reminders."
          check:
            IS_EMPTY:
              arg:
                EXTRACT: "CA10__keyExpirationPeriodDays__c"
        - status: "INCOMPLIANT"
          currentStateMessage: "Key rotation reminders are set for more than 90 days."
          remediationMessage: "Configure Key rotation reminders for 90 days."
          check:
            GREATER_THAN:
              left:
                EXTRACT: "CA10__keyExpirationPeriodDays__c"
              right:
                NUMBER: 90.0
      otherwise:
        status: "COMPLIANT"
        currentStateMessage: "Key rotation reminders are configured."
  - path: /ce/ca/azure/storage/access-key-rotation-reminders/test-data.json
    md5Hash: EBFD18EF2D1503A72FCEF7C1CD0D6980
    content: |
      [
        {
          "expectedResult": {
            "status": "DISAPPEARED",
            "conditionIndex": "99",
            "conditionText": "isDisappeared(CA10__disappearanceTime__c)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-11-06T01:39:08Z" },
          "CA10__disappearanceTime__c": "2025-10-27T14:29:45Z",
          "CA10__keyExpirationPeriodDays__c": null,
          "Id": "001",
          "RecordTypeId": "0124x000001OkZ4AAK",
          "RecordType": { "Id": "0124x000001OkZ4AAK" }
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "199",
            "conditionText": "extract('CA10__keyExpirationPeriodDays__c').isEmpty()",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-11-06T01:39:08Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__keyExpirationPeriodDays__c": null,
          "Id": "002",
          "RecordTypeId": "0124x000001OkZ4AAK",
          "RecordType": { "Id": "0124x000001OkZ4AAK" }
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "299",
            "conditionText": "extract('CA10__keyExpirationPeriodDays__c') > number(90.0)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-11-06T01:39:08Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__keyExpirationPeriodDays__c": 180,
          "Id": "003",
          "RecordTypeId": "0124x000001OkZ4AAK",
          "RecordType": { "Id": "0124x000001OkZ4AAK" }
        },
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "300",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-11-06T01:39:08Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__keyExpirationPeriodDays__c": 90,
          "Id": "004",
          "RecordTypeId": "0124x000001OkZ4AAK",
          "RecordType": { "Id": "0124x000001OkZ4AAK" }
        }
      ]
  - path: /types/CA10__CaAzureStorageAccount__c/object.extracts.yaml
    md5Hash: 2FD9F962F192FC3E335D23D11315B8F9
    content: "---\nextracts:\n# This is a checkbox. Not nullable. Can't have no access,\
      \ retrieved via Microsoft.Storage/storageAccounts\n  - name: \"CA10__secureTransferRequired__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__secureTransferRequired__c\"\
      \n# Values: Enabled, Disabled. Not Nullable. Can't have no access, retrieved\
      \ via Microsoft.Storage/storageAccounts\n  - name: \"CA10__requireInfrastructureEncryptionState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__requireInfrastructureEncryptionState__c\"\
      \n        undeterminedIf:\n          isEmpty: \"Corrupted data. Require Infrastructure\
      \ Encryption setting cannot be empty.\"\n# Values: Enabled, Disabled. Not Nullable.\
      \ Can't have no access, retrieved via Microsoft.Storage/storageAccounts\n  -\
      \ name: \"CA10__publicNetworkAccessState__c\"\n    value: \n      FIELD:\n \
      \       path: \"CA10__publicNetworkAccessState__c\"\n        undeterminedIf:\n\
      \          isEmpty: \"Corrupted data. Public Network Access cannot be empty.\"\
      \n# Values: Allow, Deny. Not nullable. Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\
      \  - name: \"CA10__networkAclsDefaultAction__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__networkAclsDefaultAction__c\"\n        undeterminedIf:\n\
      \          isEmpty: \"Corrupted data. Default Network Action cannot be empty.\"\
      \n# Values: any combination of Logging|Metrics|AzureServices or None. Not nullable.\
      \ \n# Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\
      \  - name: \"CA10__networkAclsBypass__c\"\n    value: \n      FIELD:\n     \
      \   path: \"CA10__networkAclsBypass__c\"\n        undeterminedIf:\n        \
      \  isEmpty: \"Corrupted data. Network Bypass cannot be empty.\"\n# Values TLS1_0,\
      \ TLS1_1, TLS1_2. Not nullable. Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\
      \  - name: \"CA10__minimumTlsVersion__c\"\n    value: \n      FIELD:\n     \
      \   path: \"CA10__minimumTlsVersion__c\"\n        undeterminedIf:\n        \
      \  isEmpty: \"Corrupted data. TLS Version cannot be empty.\"\n# Values: Allow,\
      \ Deny, null (Old storage accounts can have null, which means that the account\
      \ can still have replication). \n# Nullable. Can't have no access, retrieved\
      \ via Microsoft.Storage/storageAccounts.\n  - name: \"CA10__crossTenantReplication__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__crossTenantReplication__c\"\
      \n# Values: Allow, Deny. Not nullable. Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\
      \  - name: \"CA10__blobPublicAccess__c\"\n    value: \n      FIELD:\n      \
      \  path: \"CA10__blobPublicAccess__c\"\n        undeterminedIf:\n          isEmpty:\
      \ \"Corrupted data. Allow Blob Anonymous Access cannot be empty.\"\n# Values\
      \ Enabled, Disabled. Not Nullable\n  - name: \"CA10__blobLoggingReadState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__blobLoggingReadState__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__blobLoggingReadState__c\"\n            currentStateMessage: \"Unable to\
      \ determine Blob Container Logging Read property. Possible permission issue\
      \ with Microsoft.Storage/storageAccounts/blobServices/containers/read\"\n  \
      \        isEmpty: \"Storage Blob Logging is not populated yet.\"\n# Values Enabled,\
      \ Disabled. Not Nullable\n  - name: \"CA10__blobLoggingWriteState__c\"\n   \
      \ value: \n      FIELD:\n        path: \"CA10__blobLoggingWriteState__c\"\n\
      \        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__blobLoggingWriteState__c\"\n            currentStateMessage: \"Unable\
      \ to determine Blob Container Logging Write property. Possible permission issue\
      \ with Microsoft.Storage/storageAccounts/blobServices/containers/read\"\n  \
      \        isEmpty: \"Storage Blob Logging is not populated yet.\"\n # Values\
      \ Enabled, Disabled. Not Nullable\n  - name: \"CA10__blobLoggingDeleteState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__blobLoggingDeleteState__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__blobLoggingDeleteState__c\"\n            currentStateMessage: \"Unable\
      \ to determine Blob Container Logging Delete property. Possible permission issue\
      \ with Microsoft.Storage/storageAccounts/blobServices/containers/read\"\n  \
      \        isEmpty: \"Storage Blob Logging is not populated yet.\"\n# Values Enabled,\
      \ Disabled. Not Nullable\n  - name: \"CA10__queueLoggingReadState__c\"\n   \
      \ value: \n      FIELD:\n        path: \"CA10__queueLoggingReadState__c\"\n\
      \        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__queueLoggingReadState__c\"\n            currentStateMessage: \"Unable\
      \ to determine Queue Logging Read property. Possible permission issue with Microsoft.Storage/storageAccounts/queueServices/queues/read\"\
      \n          isEmpty: \"Storage Queue Logging is not populated yet.\"\n# Values\
      \ Enabled, Disabled. Not Nullable\n  - name: \"CA10__queueLoggingWriteState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__queueLoggingWriteState__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__queueLoggingWriteState__c\"\n            currentStateMessage: \"Unable\
      \ to determine Queue Logging Write property. Possible permission issue with\
      \ Microsoft.Storage/storageAccounts/queueServices/queues/read\"\n          isEmpty:\
      \ \"Storage Queue Logging is not populated yet.\"\n# Values Enabled, Disabled.\
      \ Not Nullable\n  - name: \"CA10__queueLoggingDeleteState__c\"\n    value: \n\
      \      FIELD:\n        path: \"CA10__queueLoggingDeleteState__c\"\n        undeterminedIf:\n\
      \          noAccessDelegate:\n            path: \"CA10__queueLoggingDeleteState__c\"\
      \n            currentStateMessage: \"Unable to determine Queue Logging Delete\
      \ property. Possible permission issue with Microsoft.Storage/storageAccounts/queueServices/queues/read\"\
      \n          isEmpty: \"Storage Queue Logging is not populated yet.\"\n# Values\
      \ Enabled, Disabled. Not Nullable\n  - name: \"CA10__tableLoggingReadState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__tableLoggingReadState__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__tableLoggingReadState__c\"\n            currentStateMessage: \"Unable\
      \ to determine Table Logging Read property. Possible permission issue with Microsoft.Storage/storageAccounts/tableServices/tables/read\"\
      \n          isEmpty: \"Storage Table Logging is not populated yet.\"\n# Values\
      \ Enabled, Disabled. Not Nullable\n  - name: \"CA10__tableLoggingWriteState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__tableLoggingWriteState__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__tableLoggingWriteState__c\"\n            currentStateMessage: \"Unable\
      \ to determine Table Logging Write property. Possible permission issue with\
      \ Microsoft.Storage/storageAccounts/tableServices/tables/read\"\n          isEmpty:\
      \ \"Storage Table Logging is not populated yet.\"\n# Values Enabled, Disabled.\
      \ Not Nullable\n  - name: \"CA10__tableLoggingDeleteState__c\"\n    value: \n\
      \      FIELD:\n        path: \"CA10__tableLoggingDeleteState__c\"\n        undeterminedIf:\n\
      \          noAccessDelegate:\n            path: \"CA10__tableLoggingDeleteState__c\"\
      \n            currentStateMessage: \"Unable to determine Table Logging Delete\
      \ property. Possible permission issue with Microsoft.Storage/storageAccounts/tableServices/tables/read\"\
      \n          isEmpty: \"Storage Table Logging is not populated yet.\"\n# Values\
      \ Microsoft.Storage, Microsoft.Keyvault. Not Nullable. Can't have no access,\
      \ retrieved via Microsoft.Storage/storageAccounts\n  - name: \"CA10__encryptionKeySource__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__encryptionKeySource__c\"\n\
      \        undeterminedIf:\n          isEmpty: \"Corrupted data. Encryption Key\
      \ Source cannot be empty.\"\n# Nullable. Can't have no access, retrieved via\
      \ Microsoft.Storage/storageAccounts\n  - name: \"CA10__encryptionKeyVaultUri__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__encryptionKeyVaultUri__c\"\
      \n# Nullable. \n  - name: \"CA10__blobRetentionPolicyDays__c\"\n    value: \n\
      \      FIELD:\n        path: \"CA10__blobRetentionPolicyDays__c\"\n# Values:\
      \ Enabled, Disabled. Nullable. \n  - name: \"CA10__blobRetentionPolicyState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__blobRetentionPolicyState__c\"\
      \n# Nullable. \n  - name: \"CA10__containerRetentionPolicyDays__c\"\n    value:\
      \ \n      FIELD:\n        path: \"CA10__containerRetentionPolicyDays__c\"\n\
      # Values: Enabled, Disabled. Nullable. \n  - name: \"CA10__containerRetentionPolicyState__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__containerRetentionPolicyState__c\"\
      \n# Nullable. Text field.\n  - name: \"CA10__skuName__c\"\n    value:\n    \
      \  FIELD:\n        path: \"CA10__skuName__c\"\n# Nullable. Text field.\n  -\
      \ name: \"CA10__defaultToOAuthAuthentication__c\"\n    value:\n      FIELD:\n\
      \        path: \"CA10__defaultToOAuthAuthentication__c\"\n# Nullable. Text field.\n\
      \  - name: \"CA10__sharedKeyAccess__c\"\n    value:\n      FIELD:\n        path:\
      \ \"CA10__sharedKeyAccess__c\"\n# Nullable. Text field.\n  - name: \"CA10__blobVersioning__c\"\
      \n    value:\n      FIELD:\n        path: \"CA10__blobVersioning__c\"\n# Text\
      \ field.\n  - name: \"CA10__locationName__c\"\n    value:\n      FIELD:\n  \
      \      path: \"CA10__locationName__c\"\n# Date/Time field.\n  - name: \"CA10__primaryKeyCreationTime__c\"\
      \n    value:\n      FIELD:\n        path: \"CA10__primaryKeyCreationTime__c\"\
      \n# Date/Time field.\n  - name: \"CA10__secondaryKeyCreationTime__c\"\n    value:\n\
      \      FIELD:\n        path: \"CA10__secondaryKeyCreationTime__c\"\n# Nullable.\
      \ Number field.\n  - name: \"CA10__keyExpirationPeriodDays__c\"\n    value:\n\
      \      FIELD:\n        path: \"CA10__keyExpirationPeriodDays__c\"\n\n      \
      \  "
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" : "001",
    "expectedResult" : {
      "status" : "DISAPPEARED",
      "conditionIndex" : "99",
      "conditionText" : "isDisappeared(CA10__disappearanceTime__c)",
      "runtimeError" : null
    }
  }, {
    "Id" : "002",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__keyExpirationPeriodDays__c').isEmpty()",
      "runtimeError" : null
    }
  }, {
    "Id" : "003",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "299",
      "conditionText" : "extract('CA10__keyExpirationPeriodDays__c') > number(90.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "004",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "300",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAzureStorageAccount__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__keyExpirationPeriodDays__c FLOAT64,
      Id STRING,
      RecordTypeId STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-11-06T01:39:08Z")
    },
    "CA10__disappearanceTime__c" : new Date("2025-10-27T14:29:45Z"),
    "CA10__keyExpirationPeriodDays__c" : null,
    "Id" : "001",
    "RecordTypeId" : "0124x000001OkZ4AAK"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-11-06T01:39:08Z")
    },
    "CA10__keyExpirationPeriodDays__c" : null,
    "Id" : "002",
    "RecordTypeId" : "0124x000001OkZ4AAK"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-11-06T01:39:08Z")
    },
    "CA10__keyExpirationPeriodDays__c" : 180,
    "Id" : "003",
    "RecordTypeId" : "0124x000001OkZ4AAK"
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-11-06T01:39:08Z")
    },
    "CA10__keyExpirationPeriodDays__c" : 90,
    "Id" : "004",
    "RecordTypeId" : "0124x000001OkZ4AAK"
  } ];
  """;

  CREATE TEMP FUNCTION mock_RecordType()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-11-06T01:39:08Z")
    },
    "Id" : "0124x000001OkZ4AAK"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAzureStorageAccount__c(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__keyExpirationPeriodDays__c FLOAT64,
          Id STRING,
          RecordTypeId STRING,
          RecordType STRUCT<
              Id 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 IsEmptyLib = new function () {
      this.simpleIsEmpty = function(arg) {
          return arg == null;
      };
      this.simpleIsNotEmpty = function(arg) {
          return arg != null;
      };
  }();
      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 extract3() { if (!this.out) { this.out = obj.CA10__keyExpirationPeriodDays__c; } return this.out; };
      references1.push('Key Expiration Period, Days [obj.CA10__keyExpirationPeriodDays__c]: ' + obj.CA10__keyExpirationPeriodDays__c);
      if (IsEmptyLib.simpleIsEmpty(extract3.call(extract3))) {
          return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__keyExpirationPeriodDays__c').isEmpty()", currentStateMessage: "Key rotation reminders are not configured.", currentStateReferences: references1.join('\n'), remediation: "Configure the Key rotation reminders.", runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function extract7() { if (!this.out) { this.out = obj.CA10__keyExpirationPeriodDays__c; } return this.out; };
      if (extract7.call(extract7) != null && 90.0 != null && extract7.call(extract7) > 90.0) {
          return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__keyExpirationPeriodDays__c') > number(90.0)", currentStateMessage: "Key rotation reminders are set for more than 90 days.", currentStateReferences: references1.join('\n'), remediation: "Configure Key rotation reminders for 90 days.", runtimeError: null};
      }
      return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "Key rotation reminders are configured.", 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.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
          sObject.CA10__keyExpirationPeriodDays__c AS CA10__keyExpirationPeriodDays__c,
          sObject.Id AS Id,
          sObject.RecordTypeId AS RecordTypeId,
          STRUCT (
              `RecordType`.Id AS Id
          ) AS RecordType,
          process_CA10__CaAzureStorageAccount__c(
              STRUCT(
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__keyExpirationPeriodDays__c AS CA10__keyExpirationPeriodDays__c,
                  sObject.Id AS Id,
                  sObject.RecordTypeId AS RecordTypeId,
                  STRUCT (
                      `RecordType`.Id AS Id
                  ) AS RecordType
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAzureStorageAccount__c()) AS sObject
      LEFT JOIN UNNEST(mock_RecordType()) AS `RecordType`
          ON sObject.RecordTypeId = `RecordType`.Id
  ) sObject ON sObject.Id = expectedResult.Id;
