Triage and Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration “Enable Microsoft Defender for Cloud for Virtual Machines” for Azure using Azure console, follow the below steps:
- Login to the Azure portal (https://portal.azure.com/)
- Select the Virtual Machine on which you want to enable Microsoft Defender for Cloud
- Under the “Settings” section, select “Security + Compliance”
- Click on “Security Center” to open the Security Center blade
- On the Security Center blade, click on “Recommendations”
- Look for the recommendation “Enable Microsoft Defender for Cloud for Virtual Machines” and click on it
- Click on the “Remediate” button to enable Microsoft Defender for Cloud for the selected Virtual Machine
- Once the remediation is complete, verify that Microsoft Defender for Cloud is enabled for the Virtual Machine by going to the “Security + Compliance” section and checking the status of the Microsoft Defender for Cloud.
Using CLI
Using CLI
To enable Microsoft Defender for Cloud for Virtual Machines in Azure, follow the below steps using Azure CLI:
-
Open the Azure CLI and login to your Azure account using the command:
-
Once you are logged in, set the subscription to the one you want to work with using the command:
-
Next, enable the Microsoft Defender for Cloud for Virtual Machines using the command:
Replace
<virtual_machine_name>
with the name of the virtual machine you want to enable Microsoft Defender for Cloud and<resource_group_name>
with the name of the resource group where the virtual machine is located. -
Wait for a few minutes for the changes to take effect. Once the changes are applied, you can verify the status of Microsoft Defender for Cloud for Virtual Machines using the command:
This command will return the status of Microsoft Defender for Cloud for Virtual Machines for the specified virtual machine.
Using Python
Using Python
To enable Microsoft Defender for Cloud for Virtual Machines in Azure using Python, follow these steps:
- Install the Azure SDK for Python using the following command:
- Authenticate with Azure using the Azure CLI or by providing your credentials directly in the code.
- Use the following Python code to enable Microsoft Defender for Cloud for Virtual Machines:
- Replace the values in the variables with your own values.
- Run the Python code to enable Microsoft Defender for Cloud for Virtual Machines in Azure. This will create an extension on the virtual machine that enables Microsoft Defender for Cloud and configures it with the specified settings.