Blog Post

Microsoft Defender for Cloud Blog
3 MIN READ

Continuously export security findings from vulnerability assessment solution recommendations

OrSerokJeppa's avatar
OrSerokJeppa
Icon for Microsoft rankMicrosoft
Sep 07, 2020

Azure Security Center offers vulnerability assessment solutions for various resource types (e.g. Virtual Machines, SQL servers and databases and Container Registries). Vulnerability assessment solutions scan your resources periodically and help you monitor and remediate health issues on your resources. Security Center provides security recommendations that include all found vulnerabilities, along with remediation steps, and are updated with each scan when any new vulnerability is found. Each vulnerability is a security finding, and all security findings are available in the Security Center Portal under the related recommendation.

Using continuous export you can export these security findings in real-time (with every periodic scan of your resources) to Event Hub or Log Analytics workspace, for further analysis or integration with external workflows.

 

Implementation

To enable continuous export for security findings, follow the steps below:

 

  1. In the Azure Portal go to ‘Security Center’.
  2. Click on Pricing & settings.
  3. Select the desired subscription.
  4. Click on Continuous export.
  5. Enable export of security recommendations. Make sure that the recommendations you would like to export security findings for are selected in the recommendations drop down menu.
  6. Choose the Resource Group in which the automation resource will be created.
  7. Fill in the details of your export destination (Event Hub/Log Analytics workspace).
  8. Click on the Include security findings toggle to enable export of the security findings.
  9. Click Save.

 

Please note that to receive security findings on your resources, you should first install the vulnerability assessment solution on the relevant resources.

 

Data schemas

For export to Event Hub, the data schema is in line with the Sub Assessments API. When exporting the data to Log Analytics workspace the data will be exported to SecurityNestedRecommendation table, in the following schema:

 

Please note that the data is exported as one line per vulnerability per resource.

 

Common queries for Log Analytics workspace

When consuming security findings data through Log Analytics workspace, you might like to further analyze the data. Below are common queries for different vulnerability assessment solutions, follow the steps below to use them:

  1. In Azure Portal, navigate to the Log Analytics workspace to which you enabled continuous export.
  2. Click on Logs.
  3. Copy and paste a query from the samples described below.
  4. Set the desired Time range.
  5. Click Run.

Sample queries

Join security findings with security recommendations table:

SecurityNestedRecommendation

| extend RecommendationId=ParentRecommendationId, SubscriptionId=RecommendationSubscriptionId

| join kind=inner (

SecurityRecommendation

| extend SubscriptionId= extract(@"/subscriptions/(.+)/resourceGroup",1,AssessedResourceId))

on SubscriptionId, RecommendationId

 

Extract server name and database name for SQL recommendation Vulnerability Assessment findings on your SQL databases should be remediated:

SecurityNestedRecommendation

| where ParentRecommendationId == "82e20e14-edc5-4373-bfc4-f13121257c37" //Vulnerability Assessment findings on your SQL databases should be remediated

| extend ServerName = extract(@"/servers/(.+)/databases", 1, AssessedResourceId)

| extend DatabaseName = extract(@"(.+)/(.+)", 2, AssessedResourceId)

 

Extract computer name for VM recommendation Vulnerabilities in your virtual machines should be remediated:

SecurityNestedRecommendation

| where ParentRecommendationId == "1195afff-c881-495e-9bc5-1486211ae03f" //Vulnerabilities in your virtual machines should be remediated

| extend VMName = extract(@"(.+)/(.+)", 2, AssessedResourceId)

 

Extract registry resource Id, repository and image digest for Containers recommendation Vulnerabilities in Azure Container Registry images should be remediated (powered by Qualys):

SecurityNestedRecommendation

| where ParentRecommendationId == "dbd0cb49-b563-45e7-9724-889e799fa648"//Vulnerabilities in Azure Container Registry images should be remediated (powered by Qualys)

| extend RegistryResourceId = extract(@"/registries/(.+)/repositories", 1, AssessedResourceId)

| extend Repository = tostring(AdditionalData.RepositoryName)

| extend ImageDigest = tostring(AdditionalData.ImageDigest)

 

Container Registry image vulnerability assessment results per scan, for Containers recommendation Vulnerabilities in Azure Container Registry images should be remediated (powered by Qualys):

SecurityNestedRecommendation

| where ParentRecommendationId == "dbd0cb49-b563-45e7-9724-889e799fa648"//Vulnerabilities in Azure Container Registry images should be remediated (powered by Qualys)

| extend RegistryResourceId = extract(@"/registries/(.+)/repositories", 1, AssessedResourceId)

| extend Repository = tostring(AdditionalData.RepositoryName)

| extend ImageDigest = tostring(AdditionalData.ImageDigest)

| extend ScanStatus = RecommendationState

| extend ScanTime = TimeGenerated

| summarize scanFindingSeverityCount = count() by RecommendationSeverity, RegistryResourceId, Repository, ImageDigest, ScanStatus, ScanTime

| summarize severitySummary = make_bag(pack(RecommendationSeverity, scanFindingSeverityCount)) by RegistryResourceId, Repository, ImageDigest, ScanStatus, ScanTime

| order by RegistryResourceId, Repository, ImageDigest,ScanTime

 

Export to CSV file

You might like to export the results to CSV file for further analysis and tracking. Follow the steps below to do that:

  1. Click on Export.
  2. Choose the appropriate export type.

 

To learn more about Continuous Export, make sure to watch Episode 5 of Azure Security Center in the Field where we give more insights on this feature.

 

Reviewers

Yuri Diogenes, Principal Program Manager (YuriDiogenes)

Sulaiman Abu Rashed, Software Engineer

Miri Kreitenberger, Senior Software Engineer Manager

Meital Taran- Gutman, Principal PM Manager (Meital Taran- Gutman)

 

Special Thanks to Maya Herskovic, Senior Program Manager

Published Sep 07, 2020
Version 1.0
No CommentsBe the first to comment