Skip to content

feat(query): implements "Beta - Service Without Resource Logging"#7837

Merged
cx-andre-pereira merged 7 commits into
masterfrom
AST-116648_41_6.1.4_ensure_azure_monitor_resource_logging_is_enabled_for_all_services
Dec 9, 2025
Merged

feat(query): implements "Beta - Service Without Resource Logging"#7837
cx-andre-pereira merged 7 commits into
masterfrom
AST-116648_41_6.1.4_ensure_azure_monitor_resource_logging_is_enabled_for_all_services

Conversation

@cx-andre-pereira

@cx-andre-pereira cx-andre-pereira commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Reason for Proposed Changes

  • Currently there is no query to ensure that there is a "azurerm_monitor_diagnostic_setting" resource configured for all resources that support it.

  • Quoting CIS_Microsoft_Azure_Foundations_Benchmark_v5.0.0 page 275: "A lack of monitoring reduces the visibility into the data plane, and therefore an organization's ability to detect reconnaissance, authorization attempts or other malicious activity. Unlike Activity Logs, Resource Logs are not enabled by default. Specifically, without monitoring it would be impossible to tell which entities had accessed a data store that was breached. In addition, alerts for failed attempts to access APIs for Web Services or Databases are only possible when logging is enabled."

  • In this initial implementation it was decided that the query should support the 12 main resources outlined in the CIS Benchmark(page 277) :

 - Name: 'Resource logs in Key Vault should be enabled'
 - Name: 'App Service apps should have resource logs enabled'
 - Name: 'Resource logs in Batch accounts should be enabled'
 - Name: 'Resource logs in Azure Data Lake Store should be enabled'  *
 - Name: 'Resource logs in Data Lake Analytics should be enabled' *
 - Name: 'Resource logs in Event Hub should be enabled'
 - Name: 'Resource logs in IoT Hub should be enabled'
 - Name: 'Resource logs in Logic Apps should be enabled'
 - Name: 'Resource logs in Search services should be enabled'
 - Name: 'Resource logs in Service Bus should be enabled'
 - Name: 'Resource logs in Azure Stream Analytics should be enabled'
 - Name: 'Azure Application Gateway should have Resource logs enabled

Proposed Changes

  • Implemented the missing query.
  • The query is as simple as the "Vault Auditing Disabled" analog, given a resource with one of the types specified before, it simply checks if at least one "azurerm_monitor_diagnostic_setting" resource is associated with it through its "target_resource_id" field.

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions Bot added feature New feature query New query feature labels Nov 10, 2025
@github-actions

github-actions Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

kics-logo

KICS version: v2.1.17

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@github-actions github-actions Bot added terraform Terraform query azure PR related with Azure Cloud labels Nov 10, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review November 10, 2025 12:13
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner November 10, 2025 12:13

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cx-andre-pereira cx-andre-pereira merged commit 1adb776 into master Dec 9, 2025
29 checks passed
@cx-andre-pereira cx-andre-pereira deleted the AST-116648_41_6.1.4_ensure_azure_monitor_resource_logging_is_enabled_for_all_services branch December 9, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure PR related with Azure Cloud feature New feature query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants