π§ Azure Diagnostic Setting Logs export to Storage Account not encrypted with Customer-managed key - prod.logic.yaml π’
- Contextual name: π§ prod.logic.yaml π’
- ID:
/ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/prod.logic.yaml
- Located in: π Azure Diagnostic Setting Logs export to Storage Account not encrypted with Customer-managed key π’
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-05-10T12:02:51.832561477Z Open
Result | Id | Condition Index | Condition Text | Runtime Error |
---|---|---|---|---|
π’ | test1 | βοΈ 99 | βοΈ isDisappeared(CA10__disappearanceTime__c) | βοΈ null |
π’ | test2 | βοΈ 199 | βοΈ not(['caDiagnosticSettingOnAzureSubscription'].contains(RecordType.DeveloperName)) | βοΈ null |
π’ | test3 | βοΈ 299 | βοΈ isEmptyLookup('CA10__storageAccount__r') | βοΈ null |
π’ | test4 | βοΈ 399 | βοΈ extract('CA10__storageAccount__r.CA10__encryptionKeySource__c') != 'Microsoft.Keyvault' && extract('CA10__storageAccount__r.CA10__encryptionKeyVaultUri__c').isEmpty() | βοΈ null |
π’ | test5 | βοΈ 499 | βοΈ extract('CA10__storageAccount__r.CA10__encryptionKeySource__c') == 'Microsoft.Keyvault' && extract('CA10__storageAccount__r.CA10__encryptionKeyVaultUri__c').isNotEmpty() | βοΈ null |
Generationβ
File | MD5 | |
---|---|---|
Open | /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/policy.yaml | 0D4AD0E1D0D32FDC788ED3DCCEE3D3B6 |
Open | /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/prod.logic.yaml | D461FCC9CD93E9A89185440B1FE20593 |
Open | /types/CA10__CaAzureStorageAccount__c/object.extracts.yaml | 2E0979CA85C35CDB555F32B262F6942F |
Open | /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/test-data.json | 100915FC016D3402D90705864D051AF6 |
Generate FULL scriptβ
java -jar repo-manager.jar policies generate FULL /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/prod.logic.yaml
Generate DEBUG scriptβ
java -jar repo-manager.jar policies generate DEBUG /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/prod.logic.yaml
Generate CAPTURE_TEST_DATA scriptβ
java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/prod.logic.yaml
Generate TESTS scriptβ
java -jar repo-manager.jar policies generate TESTS /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/prod.logic.yaml
Execute testsβ
java -jar repo-manager.jar policies test /ce/ca/azure/monitor/diagnostic-logs-export-to-storage-without-cmk/prod.logic.yaml
Contentβ
inputType: "CA10__CaAzureDiagnosticSetting__c"
recordTypes:
- "caDiagnosticSettingOnAzureSubscription"
importExtracts:
- file: "/types/CA10__CaAzureStorageAccount__c/object.extracts.yaml"
testData:
- file: "test-data.json"
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "This Diagnostic Setting logs are not sent to a Storage account."
check:
IS_EMPTY_LOOKUP: "CA10__storageAccount__r"
- status: "INCOMPLIANT"
currentStateMessage: "This Diagnostic Setting logs are sent to a Storage account not encrypted with a Customer-managed Key."
remediationMessage: "Consider encrypting the destination Storage account with a Customer-managed encryption Key."
check:
AND:
args:
- NOT_EQUAL:
left:
EXTRACT: "CA10__storageAccount__r.CA10__encryptionKeySource__c"
right:
TEXT: "Microsoft.Keyvault"
- IS_EMPTY:
arg:
EXTRACT: "CA10__storageAccount__r.CA10__encryptionKeyVaultUri__c"
- status: "COMPLIANT"
currentStateMessage: "This Diagnostic Setting logs are sent to a Storage account encrypted with Customer-managed Key."
check:
AND:
args:
- IS_EQUAL:
left:
EXTRACT: "CA10__storageAccount__r.CA10__encryptionKeySource__c"
right:
TEXT: "Microsoft.Keyvault"
- NOT_EMPTY:
arg:
EXTRACT: "CA10__storageAccount__r.CA10__encryptionKeyVaultUri__c"
otherwise:
status: "UNDETERMINED"
currentStateMessage: "Unexpected values in the fields."