--- policy: /ce/ca/azure/subscription/activity-log-alert-for-delete-role-assignment logic: /ce/ca/azure/subscription/activity-log-alert-for-delete-role-assignment/prod.logic.yaml executionTime: 2026-11-14T12:03:43.0651251Z generationMs: 80 executionMs: 994 rows: - id: delete-role-assignment-good match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT) actual: CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT) runtimeError: {} - id: delete-role-assignment-disabled match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: delete-role-assignment-wrong-operation match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: delete-role-assignment-extra-filter match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: delete-role-assignment-no-group match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: delete-role-assignment-broken-group match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) actual: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) runtimeError: {} - id: delete-role-assignment-unknown-state match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) actual: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) runtimeError: {} - id: delete-role-assignment-none match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: delete-role-assignment-mixed-good-unknown match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT) actual: CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT) runtimeError: {} - id: delete-role-assignment-mixed-bad-unknown match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) actual: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) runtimeError: {} - id: delete-role-assignment-deleted-alert match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: delete-role-assignment-narrow match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) actual: CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED) runtimeError: {} usedFiles: - path: /ce/ca/azure/subscription/activity-log-alert-for-delete-role-assignment/policy.yaml md5Hash: 124935F63B101590C18F21E0186E3C1A content: | --- names: full: Azure Subscription Activity Log Alert for Delete Role Assignment does not exist contextual: Subscription Activity Log Alert for Delete Role Assignment does not exist description: Ensure that Activity Log Alert Exists for Delete Role Assignment. type: COMPLIANCE_POLICY categories: - SECURITY frameworkMappings: - /frameworks/cloudaware/logging-and-monitoring/alerting-and-notification - /frameworks/cis-azure-v7.0.0/06/01/02/13 - path: /ce/ca/azure/subscription/activity-log-alert-for-delete-role-assignment/prod.logic.yaml md5Hash: 7EC4E387C76D678A68E279395DD71010 content: | --- inputType: CA10__CaAzureAccount__c testData: - file: test-data.json conditions: - status: COMPLIANT currentStateMessage: An enabled subscription-wide delete role assignment alert has an action group. check: RELATED_LIST_HAS: relationshipName: CA10__Azure_Activity_Log_Alerts__r status: COMPLIANT - status: UNDETERMINED currentStateMessage: A candidate delete role assignment alert has unresolved scope or configuration. check: RELATED_LIST_HAS: relationshipName: CA10__Azure_Activity_Log_Alerts__r status: UNDETERMINED otherwise: status: INCOMPLIANT currentStateMessage: No qualifying subscription-wide delete role assignment alert exists. remediationMessage: Create an enabled Administrative Microsoft.Authorization/roleAssignments/delete alert covering the subscription, with an action group and no extra filters. relatedLists: - relationshipName: CA10__Azure_Activity_Log_Alerts__r importExtracts: - file: /types/CA10__CaAzureActivityLogAlert__c/object.extracts.yaml - file: /types/CA10__CaAzureAccount__c/object.extracts.yaml conditions: - status: INAPPLICABLE currentStateMessage: This alert is disabled. check: IS_EQUAL: left: EXTRACT: CA10__enabledStatus__c right: TEXT: Disabled - status: UNDETERMINED currentStateMessage: The alert enablement state is unexpected. check: NOT: arg: IS_EQUAL: left: EXTRACT: CA10__enabledStatus__c right: TEXT: Enabled - status: INAPPLICABLE currentStateMessage: This alert does not cover the required unfiltered Administrative operation. check: NOT: arg: JSON_QUERY_BOOLEAN: arg: EXTRACT: caJsonFrom__conditionJson__c expression: length(allOf) == `2` && length(allOf[?field=='category' && equals=='Administrative']) == `1` && length(allOf[?field=='operationName' && equals=='Microsoft.Authorization/roleAssignments/delete']) == `1` undeterminedIf: evaluationError: The collected JSON cannot be evaluated. resultTypeMismatch: The JSON query did not return a boolean. - status: INAPPLICABLE currentStateMessage: This alert is scoped to a different subscription. check: NOT: arg: CONTAINS: arg: EXTRACT: CA10__scopes__c search: EXTRACT: CA10__subscription__r.CA10__subscriptionId__c - status: UNDETERMINED currentStateMessage: The alert scope needs manual review for subscription-wide coverage. check: NOT: arg: AND: args: - STARTS_WITH: arg: EXTRACT: CA10__scopes__c search: TEXT: /subscriptions/ - ENDS_WITH: arg: EXTRACT: CA10__scopes__c search: EXTRACT: CA10__subscription__r.CA10__subscriptionId__c - IS_EQUAL: left: SIZE: arg: SET_FROM: arg: EXTRACT: CA10__scopes__c separator: / right: NUMBER: 2 - status: COMPLIANT currentStateMessage: This alert covers the operation across the subscription and has an action group. check: RELATED_LIST_HAS: relationshipName: CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r status: COMPLIANT - status: UNDETERMINED currentStateMessage: The configured action group cannot be resolved. check: RELATED_LIST_HAS: relationshipName: CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r status: UNDETERMINED otherwise: status: INAPPLICABLE currentStateMessage: This alert has no current action group. relatedLists: - relationshipName: CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r conditions: - status: COMPLIANT currentStateMessage: The alert action group is resolved. check: NOT_EMPTY_LOOKUP: CA10Z1__actionGroup__r otherwise: status: UNDETERMINED currentStateMessage: The configured alert action group is unavailable. - path: /ce/ca/azure/subscription/activity-log-alert-for-delete-role-assignment/test-data.json md5Hash: 7BAE84429B660253E6688AEA4DD7ED41 content: | [ { "Id": "delete-role-assignment-good", "CA10__subscriptionId__c": "delete-role-assignment-good", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-good-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-good", "CA10__subscription__r": { "Id": "delete-role-assignment-good", "CA10__subscriptionId__c": "delete-role-assignment-good" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-good", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-good-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-good-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-good-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-good-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-good/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-good-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-good/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-good-link" } ] } ], "expectedResult": { "status": "COMPLIANT", "runtimeError": null, "conditionIndex": 199, "conditionText": "CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT)" } }, { "Id": "delete-role-assignment-disabled", "CA10__subscriptionId__c": "delete-role-assignment-disabled", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-disabled-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-disabled", "CA10__subscription__r": { "Id": "delete-role-assignment-disabled", "CA10__subscriptionId__c": "delete-role-assignment-disabled" }, "CA10__enabledStatus__c": "Disabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-disabled", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-disabled-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-disabled-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-disabled-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-disabled-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-disabled/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-disabled-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-disabled/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-disabled-link" } ] } ], "expectedResult": { "status": "INCOMPLIANT", "runtimeError": null, "conditionIndex": 300, "conditionText": "otherwise" } }, { "Id": "delete-role-assignment-wrong-operation", "CA10__subscriptionId__c": "delete-role-assignment-wrong-operation", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-wrong-operation-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-wrong-operation", "CA10__subscription__r": { "Id": "delete-role-assignment-wrong-operation", "CA10__subscriptionId__c": "delete-role-assignment-wrong-operation" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Resources/subscriptions/resourceGroups/write\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-wrong-operation", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-wrong-operation-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-wrong-operation-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-wrong-operation-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-wrong-operation-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-wrong-operation/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-wrong-operation-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-wrong-operation/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-wrong-operation-link" } ] } ], "expectedResult": { "status": "INCOMPLIANT", "runtimeError": null, "conditionIndex": 300, "conditionText": "otherwise" } }, { "Id": "delete-role-assignment-extra-filter", "CA10__subscriptionId__c": "delete-role-assignment-extra-filter", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-extra-filter-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-extra-filter", "CA10__subscription__r": { "Id": "delete-role-assignment-extra-filter", "CA10__subscriptionId__c": "delete-role-assignment-extra-filter" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}, {\"field\": \"status\", \"equals\": \"Succeeded\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-extra-filter", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-extra-filter-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-extra-filter-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-extra-filter-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-extra-filter-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-extra-filter/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-extra-filter-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-extra-filter/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-extra-filter-link" } ] } ], "expectedResult": { "status": "INCOMPLIANT", "runtimeError": null, "conditionIndex": 300, "conditionText": "otherwise" } }, { "Id": "delete-role-assignment-no-group", "CA10__subscriptionId__c": "delete-role-assignment-no-group", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-no-group-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-no-group", "CA10__subscription__r": { "Id": "delete-role-assignment-no-group", "CA10__subscriptionId__c": "delete-role-assignment-no-group" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-no-group", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [] } ], "expectedResult": { "status": "INCOMPLIANT", "runtimeError": null, "conditionIndex": 300, "conditionText": "otherwise" } }, { "Id": "delete-role-assignment-broken-group", "CA10__subscriptionId__c": "delete-role-assignment-broken-group", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-broken-group-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-broken-group", "CA10__subscription__r": { "Id": "delete-role-assignment-broken-group", "CA10__subscriptionId__c": "delete-role-assignment-broken-group" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-broken-group", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-broken-group-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-broken-group-alert", "CA10Z1__actionGroup__c": null, "CA10Z1__actionGroup__r": { "Id": null, "CA10Z1__disappearanceTime__c": null }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-broken-group/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-broken-group-link" } ] } ], "expectedResult": { "status": "UNDETERMINED", "runtimeError": null, "conditionIndex": 299, "conditionText": "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } }, { "Id": "delete-role-assignment-unknown-state", "CA10__subscriptionId__c": "delete-role-assignment-unknown-state", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-unknown-state-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-unknown-state", "CA10__subscription__r": { "Id": "delete-role-assignment-unknown-state", "CA10__subscriptionId__c": "delete-role-assignment-unknown-state" }, "CA10__enabledStatus__c": "Future", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-unknown-state", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-unknown-state-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-unknown-state-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-unknown-state-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-unknown-state-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-unknown-state/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-unknown-state-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-unknown-state/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-unknown-state-link" } ] } ], "expectedResult": { "status": "UNDETERMINED", "runtimeError": null, "conditionIndex": 299, "conditionText": "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } }, { "Id": "delete-role-assignment-none", "CA10__subscriptionId__c": "delete-role-assignment-none", "CA10__Azure_Activity_Log_Alerts__r": [], "expectedResult": { "status": "INCOMPLIANT", "runtimeError": null, "conditionIndex": 300, "conditionText": "otherwise" } }, { "Id": "delete-role-assignment-mixed-good-unknown", "CA10__subscriptionId__c": "delete-role-assignment-mixed-good-unknown", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-mixed-good-unknown-good-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-mixed-good-unknown", "CA10__subscription__r": { "Id": "delete-role-assignment-mixed-good-unknown", "CA10__subscriptionId__c": "delete-role-assignment-mixed-good-unknown" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-mixed-good-unknown", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-mixed-good-unknown-good-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-mixed-good-unknown-good-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-mixed-good-unknown-good-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-mixed-good-unknown-good-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-mixed-good-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-good-unknown-good-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-mixed-good-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-good-unknown-good-link" } ] }, { "Id": "delete-role-assignment-mixed-good-unknown-broken-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-mixed-good-unknown", "CA10__subscription__r": { "Id": "delete-role-assignment-mixed-good-unknown", "CA10__subscriptionId__c": "delete-role-assignment-mixed-good-unknown" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-mixed-good-unknown", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-mixed-good-unknown-broken-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-mixed-good-unknown-broken-alert", "CA10Z1__actionGroup__c": null, "CA10Z1__actionGroup__r": { "Id": null, "CA10Z1__disappearanceTime__c": null }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-mixed-good-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-good-unknown-broken-link" } ] } ], "expectedResult": { "status": "COMPLIANT", "runtimeError": null, "conditionIndex": 199, "conditionText": "CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT)" } }, { "Id": "delete-role-assignment-mixed-bad-unknown", "CA10__subscriptionId__c": "delete-role-assignment-mixed-bad-unknown", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-mixed-bad-unknown-disabled-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-mixed-bad-unknown", "CA10__subscription__r": { "Id": "delete-role-assignment-mixed-bad-unknown", "CA10__subscriptionId__c": "delete-role-assignment-mixed-bad-unknown" }, "CA10__enabledStatus__c": "Disabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-mixed-bad-unknown", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-mixed-bad-unknown-disabled-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-mixed-bad-unknown-disabled-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-mixed-bad-unknown-disabled-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-mixed-bad-unknown-disabled-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-mixed-bad-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-bad-unknown-disabled-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-mixed-bad-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-bad-unknown-disabled-link" } ] }, { "Id": "delete-role-assignment-mixed-bad-unknown-broken-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-mixed-bad-unknown", "CA10__subscription__r": { "Id": "delete-role-assignment-mixed-bad-unknown", "CA10__subscriptionId__c": "delete-role-assignment-mixed-bad-unknown" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-mixed-bad-unknown", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-mixed-bad-unknown-broken-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-mixed-bad-unknown-broken-alert", "CA10Z1__actionGroup__c": null, "CA10Z1__actionGroup__r": { "Id": null, "CA10Z1__disappearanceTime__c": null }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-mixed-bad-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-bad-unknown-broken-link" } ] } ], "expectedResult": { "status": "UNDETERMINED", "runtimeError": null, "conditionIndex": 299, "conditionText": "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } }, { "Id": "delete-role-assignment-deleted-alert", "CA10__subscriptionId__c": "delete-role-assignment-deleted-alert", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-deleted-alert-deleted-alert", "CA10__disappearanceTime__c": "2026-01-01T00:00:00Z", "CA10__subscription__c": "delete-role-assignment-deleted-alert", "CA10__subscription__r": { "Id": "delete-role-assignment-deleted-alert", "CA10__subscriptionId__c": "delete-role-assignment-deleted-alert" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-deleted-alert", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-deleted-alert-deleted-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-deleted-alert-deleted-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-deleted-alert-deleted-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-deleted-alert-deleted-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-deleted-alert/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-deleted-alert-deleted-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-deleted-alert/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-deleted-alert-deleted-link" } ] } ], "expectedResult": { "status": "INCOMPLIANT", "runtimeError": null, "conditionIndex": 300, "conditionText": "otherwise" } }, { "Id": "delete-role-assignment-narrow", "CA10__subscriptionId__c": "delete-role-assignment-narrow", "CA10__Azure_Activity_Log_Alerts__r": [ { "Id": "delete-role-assignment-narrow-alert", "CA10__disappearanceTime__c": null, "CA10__subscription__c": "delete-role-assignment-narrow", "CA10__subscription__r": { "Id": "delete-role-assignment-narrow", "CA10__subscriptionId__c": "delete-role-assignment-narrow" }, "CA10__enabledStatus__c": "Enabled", "CA10__conditionJson__c": "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c": "/subscriptions/delete-role-assignment-narrow/resourceGroups/limited", "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r": [ { "Id": "delete-role-assignment-narrow-link", "CA10Z1__disappearanceTime__c": null, "CA10Z1__activityLogAlert__c": "delete-role-assignment-narrow-alert", "CA10Z1__actionGroup__c": "delete-role-assignment-narrow-group", "CA10Z1__actionGroup__r": { "Id": "delete-role-assignment-narrow-group", "CA10Z1__disappearanceTime__c": null, "CA10Z1__resourceId__c": "/subscriptions/delete-role-assignment-narrow/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-narrow-link" }, "CA10Z1__actionGroupId__c": "/subscriptions/delete-role-assignment-narrow/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-narrow-link" } ] } ], "expectedResult": { "status": "UNDETERMINED", "runtimeError": null, "conditionIndex": 299, "conditionText": "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } } ] - path: /types/CA10__CaAzureActivityLogAlert__c/object.extracts.yaml md5Hash: 8A1FFCB1A6A450C933A1A1E63AD96EA2 content: "---\nextracts:\n# Not nullable. Can't have no access, retrieved via\ \ Microsoft.Insights/ActivityLogAlerts\n - name: \"CA10__enabledStatus__c\"\ \n value: \n FIELD:\n path: \"CA10__enabledStatus__c\"\n \ \ undeterminedIf:\n isEmpty: \"Corrupted data. Status cannot be\ \ empty.\"\n# Not nullable. Can't have no access, retrieved via Microsoft.Insights/ActivityLogAlerts\n\ \ - name: \"CA10__conditionJson__c\"\n value: \n FIELD:\n path:\ \ \"CA10__conditionJson__c\"\n returnType: BYTES\n undeterminedIf:\n\ \ isEmpty: \"Corrupted data. Condition cannot be empty.\"\n - name:\ \ \"caJsonFrom__conditionJson__c\"\n value: \n JSON_FROM:\n arg:\ \ \n EXTRACT: \"CA10__conditionJson__c\"\n undeterminedIf:\n\ \ isInvalid: \"Condition JSON is invalid.\"\n# Not nullable. Can't\ \ have no access, retrieved via Microsoft.Insights/ActivityLogAlerts\n - name:\ \ \"CA10__scopes__c\"\n value: \n FIELD:\n path: \"CA10__scopes__c\"\ \n undeterminedIf:\n isEmpty: \"Corrupted data. Scopes cannot\ \ be empty.\"\n" - path: /types/CA10__CaAzureAccount__c/object.extracts.yaml md5Hash: 3FFDE42186EE2CD29391A3CBD86FC4C0 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: \"caJsonText__securityCenterContactsDefaultRoles__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: \"caJsonText__securityCenterContactsDefaultState__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: \"caJsonText__securityCenterContactsDefaultEmail__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: \"caJsonText__securityCenterContactsDefaultAlertNotifications__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: \"caJsonText__securityCenterContactsDefaultAlertNotificationsSeverity__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 >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "delete-role-assignment-good", "expectedResult" : { "status" : "COMPLIANT", "runtimeError" : null, "conditionIndex" : 199, "conditionText" : "CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT)" } }, { "Id" : "delete-role-assignment-disabled", "expectedResult" : { "status" : "INCOMPLIANT", "runtimeError" : null, "conditionIndex" : 300, "conditionText" : "otherwise" } }, { "Id" : "delete-role-assignment-wrong-operation", "expectedResult" : { "status" : "INCOMPLIANT", "runtimeError" : null, "conditionIndex" : 300, "conditionText" : "otherwise" } }, { "Id" : "delete-role-assignment-extra-filter", "expectedResult" : { "status" : "INCOMPLIANT", "runtimeError" : null, "conditionIndex" : 300, "conditionText" : "otherwise" } }, { "Id" : "delete-role-assignment-no-group", "expectedResult" : { "status" : "INCOMPLIANT", "runtimeError" : null, "conditionIndex" : 300, "conditionText" : "otherwise" } }, { "Id" : "delete-role-assignment-broken-group", "expectedResult" : { "status" : "UNDETERMINED", "runtimeError" : null, "conditionIndex" : 299, "conditionText" : "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } }, { "Id" : "delete-role-assignment-unknown-state", "expectedResult" : { "status" : "UNDETERMINED", "runtimeError" : null, "conditionIndex" : 299, "conditionText" : "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } }, { "Id" : "delete-role-assignment-none", "expectedResult" : { "status" : "INCOMPLIANT", "runtimeError" : null, "conditionIndex" : 300, "conditionText" : "otherwise" } }, { "Id" : "delete-role-assignment-mixed-good-unknown", "expectedResult" : { "status" : "COMPLIANT", "runtimeError" : null, "conditionIndex" : 199, "conditionText" : "CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT)" } }, { "Id" : "delete-role-assignment-mixed-bad-unknown", "expectedResult" : { "status" : "UNDETERMINED", "runtimeError" : null, "conditionIndex" : 299, "conditionText" : "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } }, { "Id" : "delete-role-assignment-deleted-alert", "expectedResult" : { "status" : "INCOMPLIANT", "runtimeError" : null, "conditionIndex" : 300, "conditionText" : "otherwise" } }, { "Id" : "delete-role-assignment-narrow", "expectedResult" : { "status" : "UNDETERMINED", "runtimeError" : null, "conditionIndex" : 299, "conditionText" : "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)" } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAzureActivityLogAlert__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-good", "CA10__subscription__c" : "delete-role-assignment-good", "Id" : "delete-role-assignment-good-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Disabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-disabled", "CA10__subscription__c" : "delete-role-assignment-disabled", "Id" : "delete-role-assignment-disabled-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Resources/subscriptions/resourceGroups/write\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-wrong-operation", "CA10__subscription__c" : "delete-role-assignment-wrong-operation", "Id" : "delete-role-assignment-wrong-operation-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}, {\"field\": \"status\", \"equals\": \"Succeeded\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-extra-filter", "CA10__subscription__c" : "delete-role-assignment-extra-filter", "Id" : "delete-role-assignment-extra-filter-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-no-group", "CA10__subscription__c" : "delete-role-assignment-no-group", "Id" : "delete-role-assignment-no-group-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-broken-group", "CA10__subscription__c" : "delete-role-assignment-broken-group", "Id" : "delete-role-assignment-broken-group-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Future", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-unknown-state", "CA10__subscription__c" : "delete-role-assignment-unknown-state", "Id" : "delete-role-assignment-unknown-state-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-mixed-good-unknown", "CA10__subscription__c" : "delete-role-assignment-mixed-good-unknown", "Id" : "delete-role-assignment-mixed-good-unknown-good-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-mixed-good-unknown", "CA10__subscription__c" : "delete-role-assignment-mixed-good-unknown", "Id" : "delete-role-assignment-mixed-good-unknown-broken-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Disabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-mixed-bad-unknown", "CA10__subscription__c" : "delete-role-assignment-mixed-bad-unknown", "Id" : "delete-role-assignment-mixed-bad-unknown-disabled-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-mixed-bad-unknown", "CA10__subscription__c" : "delete-role-assignment-mixed-bad-unknown", "Id" : "delete-role-assignment-mixed-bad-unknown-broken-alert" }, { "context" : null, "CA10__disappearanceTime__c" : new Date("2026-01-01T00:00:00Z"), "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-deleted-alert", "CA10__subscription__c" : "delete-role-assignment-deleted-alert", "Id" : "delete-role-assignment-deleted-alert-deleted-alert" }, { "context" : null, "CA10__enabledStatus__c" : "Enabled", "CA10__conditionJson__c" : "{\"allOf\": [{\"field\": \"category\", \"equals\": \"Administrative\"}, {\"field\": \"operationName\", \"equals\": \"Microsoft.Authorization/roleAssignments/delete\"}]}", "CA10__scopes__c" : "/subscriptions/delete-role-assignment-narrow/resourceGroups/limited", "CA10__subscription__c" : "delete-role-assignment-narrow", "Id" : "delete-role-assignment-narrow-alert" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAzureAccount__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : null, "Id" : "delete-role-assignment-good", "CA10__subscriptionId__c" : "delete-role-assignment-good" }, { "context" : null, "Id" : "delete-role-assignment-disabled", "CA10__subscriptionId__c" : "delete-role-assignment-disabled" }, { "context" : null, "Id" : "delete-role-assignment-wrong-operation", "CA10__subscriptionId__c" : "delete-role-assignment-wrong-operation" }, { "context" : null, "Id" : "delete-role-assignment-extra-filter", "CA10__subscriptionId__c" : "delete-role-assignment-extra-filter" }, { "context" : null, "Id" : "delete-role-assignment-no-group", "CA10__subscriptionId__c" : "delete-role-assignment-no-group" }, { "context" : null, "Id" : "delete-role-assignment-broken-group", "CA10__subscriptionId__c" : "delete-role-assignment-broken-group" }, { "context" : null, "Id" : "delete-role-assignment-unknown-state", "CA10__subscriptionId__c" : "delete-role-assignment-unknown-state" }, { "Id" : "delete-role-assignment-none" }, { "context" : null, "Id" : "delete-role-assignment-mixed-good-unknown", "CA10__subscriptionId__c" : "delete-role-assignment-mixed-good-unknown" }, { "context" : null, "Id" : "delete-role-assignment-mixed-bad-unknown", "CA10__subscriptionId__c" : "delete-role-assignment-mixed-bad-unknown" }, { "context" : null, "Id" : "delete-role-assignment-deleted-alert", "CA10__subscriptionId__c" : "delete-role-assignment-deleted-alert" }, { "context" : null, "Id" : "delete-role-assignment-narrow", "CA10__subscriptionId__c" : "delete-role-assignment-narrow" } ]; """; CREATE TEMP FUNCTION mock_CA10Z1__CaAzureActivityLogAlertActionGrLink__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-good-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-good/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-good-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-good-alert", "Id" : "delete-role-assignment-good-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-disabled-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-disabled/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-disabled-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-disabled-alert", "Id" : "delete-role-assignment-disabled-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-wrong-operation-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-wrong-operation/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-wrong-operation-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-wrong-operation-alert", "Id" : "delete-role-assignment-wrong-operation-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-extra-filter-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-extra-filter/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-extra-filter-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-extra-filter-alert", "Id" : "delete-role-assignment-extra-filter-link" }, { "context" : null, "CA10Z1__actionGroup__c" : null, "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-broken-group/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-broken-group-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-broken-group-alert", "Id" : "delete-role-assignment-broken-group-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-unknown-state-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-unknown-state/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-unknown-state-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-unknown-state-alert", "Id" : "delete-role-assignment-unknown-state-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-mixed-good-unknown-good-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-mixed-good-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-good-unknown-good-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-mixed-good-unknown-good-alert", "Id" : "delete-role-assignment-mixed-good-unknown-good-link" }, { "context" : null, "CA10Z1__actionGroup__c" : null, "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-mixed-good-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-good-unknown-broken-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-mixed-good-unknown-broken-alert", "Id" : "delete-role-assignment-mixed-good-unknown-broken-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-mixed-bad-unknown-disabled-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-mixed-bad-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-bad-unknown-disabled-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-mixed-bad-unknown-disabled-alert", "Id" : "delete-role-assignment-mixed-bad-unknown-disabled-link" }, { "context" : null, "CA10Z1__actionGroup__c" : null, "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-mixed-bad-unknown/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-mixed-bad-unknown-broken-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-mixed-bad-unknown-broken-alert", "Id" : "delete-role-assignment-mixed-bad-unknown-broken-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-deleted-alert-deleted-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-deleted-alert/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-deleted-alert-deleted-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-deleted-alert-deleted-alert", "Id" : "delete-role-assignment-deleted-alert-deleted-link" }, { "context" : null, "CA10Z1__actionGroup__c" : "delete-role-assignment-narrow-group", "CA10Z1__actionGroupId__c" : "/subscriptions/delete-role-assignment-narrow/resourceGroups/rg/providers/Microsoft.Insights/actionGroups/delete-role-assignment-narrow-link", "CA10Z1__activityLogAlert__c" : "delete-role-assignment-narrow-alert", "Id" : "delete-role-assignment-narrow-link" } ]; """; CREATE TEMP FUNCTION mock_CA10Z1__CaAzureActionGroup__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : null, "Id" : "delete-role-assignment-good-group" }, { "context" : null, "Id" : "delete-role-assignment-disabled-group" }, { "context" : null, "Id" : "delete-role-assignment-wrong-operation-group" }, { "context" : null, "Id" : "delete-role-assignment-extra-filter-group" }, { "context" : null, "Id" : null }, { "context" : null, "Id" : "delete-role-assignment-unknown-state-group" }, { "context" : null, "Id" : "delete-role-assignment-mixed-good-unknown-good-group" }, { "context" : null, "Id" : "delete-role-assignment-mixed-bad-unknown-disabled-group" }, { "context" : null, "Id" : "delete-role-assignment-deleted-alert-deleted-group" }, { "context" : null, "Id" : "delete-role-assignment-narrow-group" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAzureAccount__c( obj STRUCT< CA10__Azure_Activity_Log_Alerts__r ARRAY, CA10__subscription__c STRING, CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r ARRAY, CA10Z1__actionGroup__c STRING, CA10Z1__actionGroupId__c STRING, CA10Z1__activityLogAlert__c STRING, Id STRING, result STRUCT >>, Id STRING, result STRUCT >>, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" 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}; } var count_CA10__Azure_Activity_Log_Alerts__r_COMPLIANT2 = 0; if (obj.CA10__Azure_Activity_Log_Alerts__r != null) { for (var i3 = 0; i3 < obj.CA10__Azure_Activity_Log_Alerts__r.length; i3++) { if (typeof(obj.CA10__Azure_Activity_Log_Alerts__r[i3].status) !== 'undefined') { if (obj.CA10__Azure_Activity_Log_Alerts__r[i3].status == 'COMPLIANT') { count_CA10__Azure_Activity_Log_Alerts__r_COMPLIANT2 += obj.CA10__Azure_Activity_Log_Alerts__r[i3].count; } } else { if (obj.CA10__Azure_Activity_Log_Alerts__r[i3].result.status == 'COMPLIANT') { count_CA10__Azure_Activity_Log_Alerts__r_COMPLIANT2 += 1; } } } } // condition[1], conditionIndex:[100..199] references1.push('Related list [CA10__Azure_Activity_Log_Alerts__r] ' + (count_CA10__Azure_Activity_Log_Alerts__r_COMPLIANT2 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status'); if (count_CA10__Azure_Activity_Log_Alerts__r_COMPLIANT2 > 0) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "CA10__Azure_Activity_Log_Alerts__r.has(COMPLIANT)", currentStateMessage: "An enabled subscription-wide delete role assignment alert has an action group.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10__Azure_Activity_Log_Alerts__r_UNDETERMINED4 = 0; if (obj.CA10__Azure_Activity_Log_Alerts__r != null) { for (var i5 = 0; i5 < obj.CA10__Azure_Activity_Log_Alerts__r.length; i5++) { if (typeof(obj.CA10__Azure_Activity_Log_Alerts__r[i5].status) !== 'undefined') { if (obj.CA10__Azure_Activity_Log_Alerts__r[i5].status == 'UNDETERMINED') { count_CA10__Azure_Activity_Log_Alerts__r_UNDETERMINED4 += obj.CA10__Azure_Activity_Log_Alerts__r[i5].count; } } else { if (obj.CA10__Azure_Activity_Log_Alerts__r[i5].result.status == 'UNDETERMINED') { count_CA10__Azure_Activity_Log_Alerts__r_UNDETERMINED4 += 1; } } } } // condition[2], conditionIndex:[200..299] if (count_CA10__Azure_Activity_Log_Alerts__r_UNDETERMINED4 > 0) { return {status: 'UNDETERMINED', conditionIndex: 299, conditionText: "CA10__Azure_Activity_Log_Alerts__r.has(UNDETERMINED)", currentStateMessage: "A candidate delete role assignment alert has unresolved scope or configuration.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INCOMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "No qualifying subscription-wide delete role assignment alert exists.", currentStateReferences: references1.join('\n'), remediation: "Create an enabled Administrative Microsoft.Authorization/roleAssignments/delete alert covering the subscription, with an action group and no extra filters.", runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__Azure_Activity_Log_Alerts__r_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r( obj STRUCT< CA10Z1__disappearanceTime__c TIMESTAMP, CA10Z1__actionGroup__r STRUCT< Id STRING, CA10Z1__disappearanceTime__c TIMESTAMP >, CA10Z1__actionGroup__c STRING, CA10Z1__actionGroupId__c STRING, CA10Z1__activityLogAlert__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT 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)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From Azure [CA10Z1__disappearanceTime__c]: ' + obj.CA10Z1__disappearanceTime__c); if (obj.CA10Z1__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10Z1__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] if (TextLib.isNotEmpty(obj.CA10Z1__actionGroupId__c) && TextLib.isNotEmpty(obj.CA10Z1__actionGroup__c) && obj.CA10Z1__actionGroup__r.CA10Z1__disappearanceTime__c == null) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "notEmptyLookup('CA10Z1__actionGroup__r')", currentStateMessage: "The alert action group is resolved.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "The configured alert action group is unavailable.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__Azure_Activity_Log_Alerts__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__enabledStatus__c STRING, CA10__conditionJson__c STRING, CA10__scopes__c STRING, CA10__subscription__r STRUCT< Id STRING, CA10__subscriptionId__c STRING >, CA10__subscription__c STRING, CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r ARRAY, CA10Z1__actionGroup__c STRING, CA10Z1__actionGroupId__c STRING, CA10Z1__activityLogAlert__c STRING, Id STRING, result STRUCT >>, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js OPTIONS (library=['gs://compliance-platform-public/jmespath.min.js']) AS r""" var CollectionLib = new function () { this.parse = function(arg, separator, skipEmpty, skipDuplicates, sort, normalize) { if (arg == null) return []; let parts = arg.split(separator); return this.fromArray(parts, skipEmpty, skipDuplicates, sort, normalize); }; this.fromArray = function(arr, skipEmpty, skipDuplicates, sort, normalize) { if (arr == null) return []; let result = []; let seen = new Set(); arr.forEach(el => { let normalized = normalize ? TextLib.normalize(el) : BytesLib.normalize(el); if (!skipEmpty || (normalize ? TextLib.isNotEmpty(el) : BytesLib.isNotEmpty(el))) { if (!skipDuplicates || !seen.has(normalized)) { if (skipDuplicates) seen.add(normalized); result.push(normalized); } } }); if (sort) result.sort(); return result; }; this.equal = function(left, right) { left = left == null ? [] : left; right = right == null ? [] : right; if (left.length !== right.length) return false; for (let i = 0; i < left.length; i++) { if (left[i] !== right[i]) return false; } return true; }; this.notEqual = function(left, right) { return !this.equal(left, right); }; this.size = function(collection) { return collection == null ? 0 : collection.length; }; this.startsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[0] === normalizedSearch; }; this.endsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[collection.length - 1] === normalizedSearch; }; this.contains = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; return collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)); }; this.containsAll = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.every(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; this.containsAny = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.some(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; }(); 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)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var BytesLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg; }; 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)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); 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__enabledStatus__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__enabledStatus__c.isEmpty()", currentStateMessage: "Corrupted data. Status cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__enabledStatus__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Enabled Status [obj.CA10__enabledStatus__c]: ' + obj.CA10__enabledStatus__c); try { if (TextLib.equal(extract3.call(extract3), 'Disabled')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__enabledStatus__c') == 'Disabled'", currentStateMessage: "This alert is disabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function fieldChecked7() { if (TextLib.isEmpty(obj.CA10__enabledStatus__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__enabledStatus__c.isEmpty()", currentStateMessage: "Corrupted data. Status cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__enabledStatus__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; try { if (!TextLib.equal(extract6.call(extract6), 'Enabled')) { return {status: 'UNDETERMINED', conditionIndex: 299, conditionText: "not(extract('CA10__enabledStatus__c') == 'Enabled')", currentStateMessage: "The alert enablement state is unexpected.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[3], conditionIndex:[300..399] function jsonQueryChecked8() { var input = extract10.call(extract10); var out; try { out = jmespath.search(input, 'length(allOf) == `2` && length(allOf[?field==\'category\' && equals==\'Administrative\']) == `1` && length(allOf[?field==\'operationName\' && equals==\'Microsoft.Authorization/roleAssignments/delete\']) == `1`'); if (out != null && typeof out != 'boolean') { throw new Error("UNDETERMINED condition:303", {cause: {status: 'UNDETERMINED', conditionIndex: 303, conditionText: "extract('caJsonFrom__conditionJson__c').jsonQueryText('length(allOf) == `2` && length(allOf[?field==\\'category\\' && equals==\\'Administrative\\']) == `1` && length(allOf[?field==\\'operationName\\' && equals==\\'Microsoft.Authorization/roleAssignments/delete\\']) == `1`').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return a boolean.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } } catch (e) { throw new Error("UNDETERMINED condition:304", {cause: {status: 'UNDETERMINED', conditionIndex: 304, conditionText: "extract('caJsonFrom__conditionJson__c').jsonQueryText('length(allOf) == `2` && length(allOf[?field==\\'category\\' && equals==\\'Administrative\\']) == `1` && length(allOf[?field==\\'operationName\\' && equals==\\'Microsoft.Authorization/roleAssignments/delete\\']) == `1`').isEvaluationFailed()", currentStateMessage: "The collected JSON cannot be evaluated.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function jsonChecked11() { var input = extract13.call(extract13); input = TextLib.isEmpty(input) ? null : input; var out; try { out = JSON.parse(input); } catch (e) { throw new Error("UNDETERMINED condition:302", {cause: {status: 'UNDETERMINED', conditionIndex: 302, conditionText: "extract('CA10__conditionJson__c').asJson().isInvalid()", currentStateMessage: "Condition JSON is invalid.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function fieldChecked14() { if (BytesLib.isEmpty(obj.CA10__conditionJson__c)) { throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "CA10__conditionJson__c.isEmpty()", currentStateMessage: "Corrupted data. Condition cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__conditionJson__c; } function extract13() { if (!this.out) { this.out = fieldChecked14(); } return this.out; }; function extract10() { if (!this.out) { this.out = jsonChecked11(); } return this.out; }; references1.push('Condition JSON [obj.CA10__conditionJson__c]: ' + obj.CA10__conditionJson__c); try { if (!jsonQueryChecked8()) { return {status: 'INAPPLICABLE', conditionIndex: 399, conditionText: "not(extract('caJsonFrom__conditionJson__c').jsonQueryText('length(allOf) == `2` && length(allOf[?field==\\'category\\' && equals==\\'Administrative\\']) == `1` && length(allOf[?field==\\'operationName\\' && equals==\\'Microsoft.Authorization/roleAssignments/delete\\']) == `1`'))", currentStateMessage: "This alert does not cover the required unfiltered Administrative operation.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[4], conditionIndex:[400..499] function fieldChecked17() { if (TextLib.isEmpty(obj.CA10__scopes__c)) { throw new Error("UNDETERMINED condition:401", {cause: {status: 'UNDETERMINED', conditionIndex: 401, conditionText: "CA10__scopes__c.isEmpty()", currentStateMessage: "Corrupted data. Scopes cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__scopes__c; } function extract16() { if (!this.out) { this.out = fieldChecked17(); } return this.out; }; function extractChecked18() { if (TextLib.isEmpty(obj.CA10__subscription__c)) { throw new Error("UNDETERMINED condition:402", {cause: {status: 'UNDETERMINED', conditionIndex: 402, conditionText: "extractCheck(obj.CA10__subscription__c)", currentStateMessage: "Related object via CA10__subscription__c is not present", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return extract19.call(extract19); } function fieldChecked20() { if (TextLib.isEmpty(obj.CA10__subscription__r.CA10__subscriptionId__c)) { throw new Error("UNDETERMINED condition:403", {cause: {status: 'UNDETERMINED', conditionIndex: 403, conditionText: "CA10__subscriptionId__c.isEmpty()", currentStateMessage: "Corrupted data. Subscription ID cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__subscription__r.CA10__subscriptionId__c; } function extract19() { if (!this.out) { this.out = fieldChecked20(); } return this.out; }; references1.push('Scopes [obj.CA10__scopes__c]: ' + obj.CA10__scopes__c); references1.push('Subscription ID [obj.CA10__subscription__r.CA10__subscriptionId__c]: ' + obj.CA10__subscription__r.CA10__subscriptionId__c); try { if (!TextLib.contains(extract16.call(extract16), extractChecked18())) { return {status: 'INAPPLICABLE', conditionIndex: 499, conditionText: "not(extract('CA10__scopes__c').contains(extract('CA10__subscription__r.CA10__subscriptionId__c')))", currentStateMessage: "This alert is scoped to a different subscription.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[5], conditionIndex:[500..599] function fieldChecked23() { if (TextLib.isEmpty(obj.CA10__scopes__c)) { throw new Error("UNDETERMINED condition:501", {cause: {status: 'UNDETERMINED', conditionIndex: 501, conditionText: "CA10__scopes__c.isEmpty()", currentStateMessage: "Corrupted data. Scopes cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__scopes__c; } function extract22() { if (!this.out) { this.out = fieldChecked23(); } return this.out; }; function extractChecked25() { if (TextLib.isEmpty(obj.CA10__subscription__c)) { throw new Error("UNDETERMINED condition:502", {cause: {status: 'UNDETERMINED', conditionIndex: 502, conditionText: "extractCheck(obj.CA10__subscription__c)", currentStateMessage: "Related object via CA10__subscription__c is not present", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return extract26.call(extract26); } function fieldChecked27() { if (TextLib.isEmpty(obj.CA10__subscription__r.CA10__subscriptionId__c)) { throw new Error("UNDETERMINED condition:503", {cause: {status: 'UNDETERMINED', conditionIndex: 503, conditionText: "CA10__subscriptionId__c.isEmpty()", currentStateMessage: "Corrupted data. Subscription ID cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__subscription__r.CA10__subscriptionId__c; } function extract26() { if (!this.out) { this.out = fieldChecked27(); } return this.out; }; try { if (!(TextLib.startsWith(extract22.call(extract22), '/subscriptions/') && TextLib.endsWith(extract22.call(extract22), extractChecked25()) && CollectionLib.size(CollectionLib.parse(extract22.call(extract22), '/', true, true, true, true)) == 2.0)) { return {status: 'UNDETERMINED', conditionIndex: 599, conditionText: "not(extract('CA10__scopes__c').startsWith('/subscriptions/') && extract('CA10__scopes__c').endsWith(extract('CA10__subscription__r.CA10__subscriptionId__c')) && extract('CA10__scopes__c').asSetOfText('/').size() == number(2.0))", currentStateMessage: "The alert scope needs manual review for subscription-wide coverage.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } var count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_COMPLIANT30 = 0; if (obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r != null) { for (var i31 = 0; i31 < obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r.length; i31++) { if (typeof(obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i31].status) !== 'undefined') { if (obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i31].status == 'COMPLIANT') { count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_COMPLIANT30 += obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i31].count; } } else { if (obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i31].result.status == 'COMPLIANT') { count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_COMPLIANT30 += 1; } } } } // condition[6], conditionIndex:[600..699] references1.push('Related list [CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r] ' + (count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_COMPLIANT30 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status'); if (count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_COMPLIANT30 > 0) { return {status: 'COMPLIANT', conditionIndex: 699, conditionText: "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r.has(COMPLIANT)", currentStateMessage: "This alert covers the operation across the subscription and has an action group.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_UNDETERMINED32 = 0; if (obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r != null) { for (var i33 = 0; i33 < obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r.length; i33++) { if (typeof(obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i33].status) !== 'undefined') { if (obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i33].status == 'UNDETERMINED') { count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_UNDETERMINED32 += obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i33].count; } } else { if (obj.CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r[i33].result.status == 'UNDETERMINED') { count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_UNDETERMINED32 += 1; } } } } // condition[7], conditionIndex:[700..799] if (count_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r_UNDETERMINED32 > 0) { return {status: 'UNDETERMINED', conditionIndex: 799, conditionText: "CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r.has(UNDETERMINED)", currentStateMessage: "The configured action group cannot be resolved.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INAPPLICABLE', conditionIndex: 800, conditionText: "otherwise", currentStateMessage: "This alert has no current action group.", 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 `CA10__Azure_Activity_Log_Alerts__r`.arr AS CA10__Azure_Activity_Log_Alerts__r, sObject.Id AS Id, process_CA10__CaAzureAccount__c( STRUCT( `CA10__Azure_Activity_Log_Alerts__r`.arr AS CA10__Azure_Activity_Log_Alerts__r, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAzureAccount__c()) AS sObject LEFT JOIN ( SELECT sObject.CA10__subscription__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__enabledStatus__c AS CA10__enabledStatus__c, sObject.CA10__conditionJson__c AS CA10__conditionJson__c, sObject.CA10__scopes__c AS CA10__scopes__c, STRUCT ( `CA10__subscription__r`.Id AS Id, `CA10__subscription__r`.CA10__subscriptionId__c AS CA10__subscriptionId__c ) AS CA10__subscription__r, sObject.CA10__subscription__c AS CA10__subscription__c, `CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r`.arr AS CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r, sObject.Id AS Id, process_CA10__Azure_Activity_Log_Alerts__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__enabledStatus__c AS CA10__enabledStatus__c, sObject.CA10__conditionJson__c AS CA10__conditionJson__c, sObject.CA10__scopes__c AS CA10__scopes__c, STRUCT ( `CA10__subscription__r`.Id AS Id, `CA10__subscription__r`.CA10__subscriptionId__c AS CA10__subscriptionId__c ) AS CA10__subscription__r, sObject.CA10__subscription__c AS CA10__subscription__c, `CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r`.arr AS CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAzureActivityLogAlert__c()) AS sObject LEFT JOIN UNNEST(mock_CA10__CaAzureAccount__c()) AS `CA10__subscription__r` ON sObject.CA10__subscription__c = `CA10__subscription__r`.Id LEFT JOIN ( SELECT sObject.CA10Z1__activityLogAlert__c, ARRAY_AGG( STRUCT( sObject.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c, STRUCT ( `CA10Z1__actionGroup__r`.Id AS Id, `CA10Z1__actionGroup__r`.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c ) AS CA10Z1__actionGroup__r, sObject.CA10Z1__actionGroup__c AS CA10Z1__actionGroup__c, sObject.CA10Z1__actionGroupId__c AS CA10Z1__actionGroupId__c, sObject.CA10Z1__activityLogAlert__c AS CA10Z1__activityLogAlert__c, sObject.Id AS Id, process_CA10__Azure_Activity_Log_Alerts__r_CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r( STRUCT( sObject.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c, STRUCT ( `CA10Z1__actionGroup__r`.Id AS Id, `CA10Z1__actionGroup__r`.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c ) AS CA10Z1__actionGroup__r, sObject.CA10Z1__actionGroup__c AS CA10Z1__actionGroup__c, sObject.CA10Z1__actionGroupId__c AS CA10Z1__actionGroupId__c, sObject.CA10Z1__activityLogAlert__c AS CA10Z1__activityLogAlert__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10Z1__CaAzureActivityLogAlertActionGrLink__c()) AS sObject LEFT JOIN UNNEST(mock_CA10Z1__CaAzureActionGroup__c()) AS `CA10Z1__actionGroup__r` ON sObject.CA10Z1__actionGroup__c = `CA10Z1__actionGroup__r`.Id GROUP BY sObject.CA10Z1__activityLogAlert__c ) AS `CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r` ON sObject.Id = `CA10Z1__Azure_Activity_Log_Alert_Action_Gr_Links__r`.CA10Z1__activityLogAlert__c GROUP BY sObject.CA10__subscription__c ) AS `CA10__Azure_Activity_Log_Alerts__r` ON sObject.Id = `CA10__Azure_Activity_Log_Alerts__r`.CA10__subscription__c ) sObject ON sObject.Id = expectedResult.Id;