π§ Azure Diagnostic Setting captures Administrative, Alert, Policy, and Security categories - prod.logic.yaml π’
- Contextual name: π§ prod.logic.yaml π’
- ID:
/ce/ca/azure/monitor/diagnostic-setting-categories/prod.logic.yaml
- Located in: π Azure Diagnostic Setting captures Administrative, Alert, Policy, and Security categories π’
Flagsβ
- π’ Logic test success
- π’ Logic with extracts
- π’ Logic with test data
Input Typeβ
Type | API Name | Extracts | Extract Files | Logic Files | |
---|---|---|---|---|---|
π | π Azure Diagnostic Setting | CA10__CaAzureDiagnosticSetting__c | 2 | 1 | 2 |
Usesβ
Test Results π’β
Generated at: 2025-04-24T23:45:33.087941012Z Open
Result | Id | Condition Index | Condition Text | Runtime Error |
---|---|---|---|---|
π’ | test1 | βοΈ 99 | βοΈ isDisappeared(CA10__disappearanceTime__c) | βοΈ null |
π’ | test2 | βοΈ 199 | βοΈ RecordType.DeveloperName != 'caDiagnosticSettingOnAzureSubscription' | βοΈ null |
π’ | test3 | βοΈ 299 | βοΈ not(extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Administrative].enabled | [0]') && extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Alert].enabled | [0]') && extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Policy].enabled | [0]') && extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Security].enabled | [0]')) | βοΈ null |
π’ | test4 | βοΈ 300 | βοΈ otherwise | βοΈ null |
π’ | test5 | βοΈ 299 | βοΈ not(extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Administrative].enabled | [0]') && extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Alert].enabled | [0]') && extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Policy].enabled | [0]') && extract('caJsonFrom__logsJson__c').jsonQueryText('[? category == Security].enabled | [0]')) | βοΈ null |
Generationβ
File | MD5 | |
---|---|---|
Open | /ce/ca/azure/monitor/diagnostic-setting-categories/policy.yaml | 04D060897D5FE668A60F2C537F6F9A85 |
Open | /ce/ca/azure/monitor/diagnostic-setting-categories/prod.logic.yaml | 24539B2CC16F8161AF4400D4F12AC3D1 |
Open | /ce/ca/azure/monitor/diagnostic-setting-categories/test-data.json | 7C5C255C035DF0312BE934B2B2729D36 |
Open | /types/CA10__CaAzureDiagnosticSetting__c/object.extracts.yaml | 1A315A8ECC027A42193366B24979B007 |
Generate FULL scriptβ
java -jar repo-manager.jar policies generate FULL /ce/ca/azure/monitor/diagnostic-setting-categories/prod.logic.yaml
Generate DEBUG scriptβ
java -jar repo-manager.jar policies generate DEBUG /ce/ca/azure/monitor/diagnostic-setting-categories/prod.logic.yaml
Generate CAPTURE_TEST_DATA scriptβ
java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/azure/monitor/diagnostic-setting-categories/prod.logic.yaml
Generate TESTS scriptβ
java -jar repo-manager.jar policies generate TESTS /ce/ca/azure/monitor/diagnostic-setting-categories/prod.logic.yaml
Execute testsβ
java -jar repo-manager.jar policies test /ce/ca/azure/monitor/diagnostic-setting-categories/prod.logic.yaml
Contentβ
inputType: "CA10__CaAzureDiagnosticSetting__c"
importExtracts:
- file: "/types/CA10__CaAzureDiagnosticSetting__c/object.extracts.yaml"
testData:
- file: "test-data.json"
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "This is not a subscription Diagnostic Setting."
check:
NOT_EQUAL:
left:
FIELD:
path: "RecordType.DeveloperName"
right:
TEXT: "caDiagnosticSettingOnAzureSubscription"
- status: "INCOMPLIANT"
currentStateMessage: "The diagnostic setting does not capture the appropriate activities from the management plane."
remediationMessage: "Consider configuring the diagnostic setting to capture Administrative, Alert, Policy, and Security log categories."
check:
NOT:
arg:
AND:
args:
- JSON_QUERY_BOOLEAN:
arg:
EXTRACT: "caJsonFrom__logsJson__c"
expression: "[? category == `Administrative`].enabled | [0]"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return boolean type."
- JSON_QUERY_BOOLEAN:
arg:
EXTRACT: "caJsonFrom__logsJson__c"
expression: "[? category == `Alert`].enabled | [0]"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return boolean type."
- JSON_QUERY_BOOLEAN:
arg:
EXTRACT: "caJsonFrom__logsJson__c"
expression: "[? category == `Policy`].enabled | [0]"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return boolean type."
- JSON_QUERY_BOOLEAN:
arg:
EXTRACT: "caJsonFrom__logsJson__c"
expression: "[? category == `Security`].enabled | [0]"
undeterminedIf:
evaluationError: "The JSON query has failed."
resultTypeMismatch: "The JSON query did not return boolean type."
otherwise:
status: "COMPLIANT"
currentStateMessage: "The diagnostic setting captures the appropriate activities from the management plane."