More Info:
The diagnostic setting should be configured to log the appropriate activities from the control/management plane.Risk Level
MediumAddress
SecurityCompliance Standards
CISAZURE, CBPTriage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration “Ensure Diagnostic Setting Captures Appropriate Categories” in Azure using the Azure console, follow the below steps:Step 1: Login to the Azure portal using your credentials.Step 2: In the Azure portal, navigate to the resource group that you want to remediate.Step 3: Select the resource that you want to remediate.Step 4: Click on “Diagnostic settings” under the Monitoring section in the left-hand menu.Step 5: In the “Diagnostic settings” page, click on “Add diagnostic setting”.Step 6: Provide a name for the diagnostic setting.Step 7: Under the “Logs” section, select the appropriate categories that you want to capture.Step 8: Under the “Metrics” section, select the appropriate metrics that you want to capture.Step 9: Under the “Destination details” section, select the appropriate destination where you want to send the diagnostic data.Step 10: Click on “Save” to save the diagnostic setting.By following the above steps, you can remediate the misconfiguration “Ensure Diagnostic Setting Captures Appropriate Categories” in Azure using the Azure console.
Using CLI
Using CLI
To remediate the misconfiguration “Ensure Diagnostic Setting Captures Appropriate Categories” in Azure using Azure CLI, you can follow the below steps:Step 1: Open the Azure CLI in your preferred terminal.Step 2: Run the following command to check if any diagnostic settings exist for the resource:Note: Replace Note: Replace Note: Replace Note: Replace
<resource-id> and <resource-type> with the actual values of the resource ID and resource type.Step 3: If the diagnostic settings exist, use the following command to update the categories:<category-name> with the appropriate category name that needs to be captured and <existing-diagnostic-setting-name> with the name of the existing diagnostic setting.Step 4: If the diagnostic settings do not exist, use the following command to create new diagnostic settings:<category-name> with the appropriate category name that needs to be captured and <new-diagnostic-setting-name> with the name of the new diagnostic setting.Step 5: Verify the diagnostic settings by running the following command:<diagnostic-setting-name> with the name of the diagnostic setting.By following these steps, you can remediate the misconfiguration “Ensure Diagnostic Setting Captures Appropriate Categories” in Azure using Azure CLI.Using Python
Using Python
To remediate “Ensure Diagnostic Setting Captures Appropriate Categories” misconfiguration in Azure using Python, you can follow the below steps:This will create or update the diagnostic setting for the specified resource with the specified categories and retention policy.
- Install the Azure SDK for Python using the following command:
- Authenticate to Azure using the Azure CLI or using the below code to authenticate using a service principal:
- Import the required modules:
- Set the required parameters:
- Create an instance of the
MonitorManagementClient:
- Create a
DiagnosticSettingsResourceobject with the required settings:
- Create or update the diagnostic setting for the resource:

