Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

@cx-andre-pereira cx-andre-pereira commented Oct 23, 2025

Reason for Proposed Changes

  • Currently there is no query to ensure that resources that can be associated to a "azurerm_monitor_diagnostic_setting" resource have said association in place.

  • Quoting CIS_Microsoft_Azure_Foundations_Benchmark_v5.0.0 page 194: "A diagnostic setting controls how a diagnostic log is exported. By default, logs are retained only for 90 days. Diagnostic settings should be defined so that logs can be exported and stored for a longer duration to analyze security activities within an Azure subscription.

  • Additionally, page 194 states : "Settings should be configured for all appropriate resources for your environment."

  • The initial list of resources that will be supported is as follows:

azurerm_key_vault,
azurerm_application_gateway,
azurerm_firewall,
azurerm_lb,
azurerm_public_ip,
azurerm_frontdoor,
azurerm_cdn_frontdoor_profile,
azurerm_cdn_frontdoor_endpoint,
azurerm_cdn_profile,
azurerm_cdn_endpoint,
azurerm_storage_account,
azurerm_mssql_server,
azurerm_mssql_managed_instance,
azurerm_mssql_database,
azurerm_cosmosdb_account,
azurerm_linux_web_app,
azurerm_windows_web_app,
azurerm_linux_function_app,
azurerm_windows_function_app,
azurerm_kubernetes_cluster,
azurerm_eventhub_namespace,
azurerm_servicebus_namespace,
azurerm_container_registry,
azurerm_api_management

Proposed Changes

  • Implemented the missing query.
  • The query will flag if one of the valid resources / data source does not have a "azurerm_monitor_diagnostic_setting" resource with a "target_resource_id" that specifically targets said resources/ data source.

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added feature New feature query New query feature labels Oct 23, 2025
@github-actions
Copy link
Contributor

kics-logo

KICS version: v2.1.13

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 Oct 23, 2025
@github-actions github-actions bot added the kubernetes Kubernetes query label Oct 28, 2025
@cx-andre-pereira cx-andre-pereira changed the title feat(query): implements "Beta - Subscription Activity Logs Without Diagnostic Settings" feat(query): implements "Beta - Resource Without Diagnostic Settings" Oct 28, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review October 28, 2025 14:06
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner October 28, 2025 14:06
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 kubernetes Kubernetes query query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant