Description:

Enable automatic provisioning of the monitoring agent to collect security data.


Rationale:

When the Automatic provisioning of the monitoring agent is turned on, Azure Security Center provisions the Microsoft Monitoring Agent on all existing supported Azure virtual machines and any new ones that are created. The Microsoft Monitoring Agent scans for various security-related configurations and events such as system updates, OS vulnerabilities, endpoint protection, and provides alerts.


Default Value:

By default, Automatic provisioning of the monitoring agent is set to On.


Audit:

  1. Sign in to your Azure account.

  2. Go to Security Center

  3. Select Pricing & settings blade

  4. Click on the subscription name
  5. Ensure that Automatic provisioning is set to On
    If not follow the Implementation steps


Using Azure Command Line Interface 2.0

Ensure the output of the below command is On

az account get-access-token --query 
"{subscription:subscription,accessToken:accessToken}" --out tsv | xargs -L1 bash -c 'curl -X GET -H "Authorization: Bearer $1" -H "Content-Type: application/json" 
https://management.azure.com/subscriptions/$0/providers/Microsoft.Security/au toProvisioningSettings?api-version=2017-08-01-preview' | jq '.|.value[] | select(.name=="default")'|jq '.properties.autoProvision'

Using PowerShell

Connect-AzAccount
Get-AzSecurityAutoProvisioningSetting

Ensure output for Id Name AutoProvision' is /subscriptions//providers/Microsoft.Security/autoProvisioningSettings/default default On


Remediation:

Pre-Requisite:

  1. An Azure Defender plan for Enhanced security plan (Azure Defender is free for the first 30 days. At the end of 30 days, if you choose to continue using the service, you’ll automatically charged for usage).


Implementation Steps:

  1. Go to Security Center

  2. Select Pricing & settings blade

  3. Click on the subscription name

  4. Set Automatic provisioning to On

  5. Click save


Backout Plan:

  1. Go to Security Center

  2. Click on Pricing & Settings

  3. Click on a subscription

  4. Click on Data Collection

  5. Ensure that Automatic provisioning is set to On(how we can revoke the changes)

Using Azure Command-Line Interface 2.0

Use the below command to set Automatic provisioning of monitoring agent to On.

az account get-access-token --query 
"{subscription:subscription,accessToken:accessToken}" --out tsv | xargs -L1 bash -c 'curl -X PUT -H "Authorization: Bearer $1" -H "Content-Type: application/json" 
https://management.azure.com/subscriptions/$0/providers/Microsoft.Security/au toProvisioningSettings/default?api-version=2017-08-01-preview - d@"input.json"'

Where input.json contains the Request body json data as mentioned below.

{
"id": "/subscriptions/<Your_Subscription_Id>/providers/Microsoft.Security/autoProvi sioningSettings/default",
"name": "default",
"type": "Microsoft.Security/autoProvisioningSettings", "properties": {
"autoProvision": "On"
}
}


Note:

  • Excluding any of the entries in input.json may disable the specific setting by default

  • Microsoft has recently changed APIs to get and Update the Automatic Provisioning Setting. This recommendation is updated accordingly.

References:

  1. https://docs.microsoft.com/en-us/azure/security-center/security-center-data- security

  2. https://docs.microsoft.com/en-us/azure/security-center/security-center-enable- data-collection

  3. https://msdn.microsoft.com/en-us/library/mt704062.aspx