|
| 1 | +--- |
| 2 | +title: Manage AWS assessments and standards |
| 3 | +titleSuffix: Defender for Cloud |
| 4 | +description: Learn how to create custom security assessments and standards for your AWS environment. |
| 5 | +ms.topic: how-to |
| 6 | +ms.date: 10/20/2022 |
| 7 | +--- |
| 8 | + |
| 9 | +# Manage AWS assessments and standards |
| 10 | + |
| 11 | +Security standards contain comprehensive sets of security recommendations to help secure your cloud environments. Security teams can use the readily available standards such as AWS CIS 1.2.0, AWS Foundational Security Best Practices, and AWS PCI DSS 3.2.1, or create custom standards, and assessments to meet specific internal requirements. |
| 12 | + |
| 13 | +There are three types of resources that are needed to create and manage custom assessments: |
| 14 | + |
| 15 | +- Assessment: |
| 16 | + - assessment details such as name, description, severity, remediation logic, etc. |
| 17 | + - assessment logic in KQL |
| 18 | + - the standard it belongs to |
| 19 | +- Standard: defines a set of assessments |
| 20 | +- Standard assignment: defines the scope, which the standard will evaluate. For example, specific AWS account(s). |
| 21 | + |
| 22 | +You can either use the built-in regulatory compliance standards or create your own custom standards and assessments. |
| 23 | + |
| 24 | +## Assign a built-in compliance standard to your AWS account |
| 25 | + |
| 26 | +**To assign a built-in compliance standard to your AWS account**: |
| 27 | + |
| 28 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 29 | + |
| 30 | +1. Navigate to **Microsoft Defender for Cloud** > **Environment settings**. |
| 31 | + |
| 32 | +1. Select the relevant AWS account. |
| 33 | + |
| 34 | +1. Select **Standards** > **Add** > **Standard**. |
| 35 | + |
| 36 | + :::image type="content" source="media/how-to-manage-assessments-standards/aws-add-standard.png" alt-text="Screenshot that shows you where to navigate to in order to add a AWS standard." lightbox="media/how-to-manage-assessments-standards/aws-add-standard-zoom.png"::: |
| 37 | + |
| 38 | +1. Select a built-in standard from the drop-down menu. |
| 39 | + |
| 40 | +1. Select **Save**. |
| 41 | + |
| 42 | +## Create a new custom standard for your AWS account |
| 43 | + |
| 44 | +**To create a new custom standard for your AWS account**: |
| 45 | + |
| 46 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 47 | + |
| 48 | +1. Navigate to **Microsoft Defender for Cloud** > **Environment settings**. |
| 49 | + |
| 50 | +1. Select the relevant AWS account. |
| 51 | + |
| 52 | +1. Select **Standards** > **Add** > **Standard**. |
| 53 | + |
| 54 | +1. Select **New standard**. |
| 55 | + |
| 56 | + :::image type="content" source="media/how-to-manage-assessments-standards/new-aws-standard.png" alt-text="Screenshot that shows you where to select a new AWS standard." lightbox="media/how-to-manage-assessments-standards/new-aws-standard.png"::: |
| 57 | + |
| 58 | +1. Enter a name, description and select which assessments you want to add. |
| 59 | + |
| 60 | +1. Select **Save**. |
| 61 | + |
| 62 | +## Assign a built-in assessment to your AWS account |
| 63 | + |
| 64 | +**To assign a built-in assessment to your AWS account**: |
| 65 | + |
| 66 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 67 | + |
| 68 | +1. Navigate to **Microsoft Defender for Cloud** > **Environment settings**. |
| 69 | + |
| 70 | +1. Select the relevant AWS account. |
| 71 | + |
| 72 | +1. Select **Standards** > **Add** > **Assessment**. |
| 73 | + |
| 74 | + :::image type="content" source="media/how-to-manage-assessments-standards/aws-assessment.png" alt-text="Screenshot that shows where to navigate to, to select an AWS assessment." lightbox="media/how-to-manage-assessments-standards/aws-assessment.png"::: |
| 75 | + |
| 76 | +1. Select **Existing assessment**. |
| 77 | + |
| 78 | +1. Select all relevant assessments from the drop-down menu. |
| 79 | + |
| 80 | +1. Select the standards from the drop-down menu. |
| 81 | + |
| 82 | +1. Select **Save**. |
| 83 | + |
| 84 | +## Create a new custom assessment for your AWS account |
| 85 | + |
| 86 | +**To create a new custom assessment for your AWS account**: |
| 87 | + |
| 88 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 89 | + |
| 90 | +1. Navigate to **Microsoft Defender for Cloud** > **Environment settings**. |
| 91 | + |
| 92 | +1. Select the relevant AWS account. |
| 93 | + |
| 94 | +1. Select **Standards** > **Add** > **Assessment**. |
| 95 | + |
| 96 | +1. Select **New assessment (preview)**. |
| 97 | + |
| 98 | + :::image type="content" source="media/how-to-manage-assessments-standards/new-aws-assessment.png" alt-text="Screenshot of the adding a new assessment screen for your AWS account." lightbox="media/how-to-manage-assessments-standards/new-aws-assessment.png"::: |
| 99 | + |
| 100 | +1. Enter a name, severity, and select an assessment from the drop-down menu. |
| 101 | + |
| 102 | +1. Enter a KQL query that defines the assessment logic. |
| 103 | + |
| 104 | + If you’d like to create a new query, select the ‘[Azure Data Explorer](https://dataexplorer.azure.com/clusters/securitydatastoreus.centralus/databases/DiscoveryMockDataAws)’ link. The explorer will contain mock data on all of the supported native APIs. The data will appear in the same structure as contracted in the API. |
| 105 | + |
| 106 | + :::image type="content" source="media/how-to-manage-assessments-standards/azure-data-explorer.png" alt-text="Screenshot that shows where to select to select the Azure Data Explorer link." lightbox="media/how-to-manage-assessments-standards/azure-data-explorer.png"::: |
| 107 | + |
| 108 | + See the [how to build a query](#how-to-build-a-query) section for more examples. |
| 109 | + |
| 110 | +1. Select the standards to add to this assessment. |
| 111 | + |
| 112 | +1. Select **Save**. |
| 113 | + |
| 114 | +## How to build a query |
| 115 | + |
| 116 | +The last row of the query should return all the original columns (don’t use ‘project’, ‘project-away'). End the query with an iff statement that defines the healthy or unhealthy conditions: `| extend HealthStatus = iff([boolean-logic-here], 'UNHEALTHY','HEALTHY')`. |
| 117 | + |
| 118 | +### Sample KQL queries |
| 119 | + |
| 120 | +When building a KQL query, you should use the following table structure: |
| 121 | + |
| 122 | +```kusto |
| 123 | +- TimeStamp |
| 124 | + 2021-10-07T10:30:21.403732Z |
| 125 | + - SdksInfo |
| 126 | + { |
| 127 | + "AWSSDK.EC2": "3.7.5.2" |
| 128 | + } |
| 129 | +
|
| 130 | + - RecordProviderInfo |
| 131 | + { |
| 132 | + "CloudName": "AWS", |
| 133 | + "CspmDiscoveryCloudRoleArn": "arn:aws:iam::123456789123:role/CSPMMonitoring", |
| 134 | + "Type": "MultiCloudDiscoveryServiceDataCollector", |
| 135 | + "HierarchyIdentifier": "123456789123", |
| 136 | + "ConnectorId": "b3113210-63f9-43c5-a6a7-f14a2a5b3cd0" |
| 137 | + } |
| 138 | + - RecordOrganizationInfo |
| 139 | + { |
| 140 | + "Type": "MyOrganization", |
| 141 | + "TenantId": "bda8bc53-d9f8-4248-b9a9-3a6c7fe0b92f", |
| 142 | + "SubscriptionId": "69444886-de6b-40c5-8b43-065f739fffb9", |
| 143 | + "ResourceGroupName": "MyResourceGroupName" |
| 144 | + } |
| 145 | +
|
| 146 | + - CorrelationId |
| 147 | + 4f5e50e1d92c400caf507036a1237c72 |
| 148 | + - RecordRegionalInfo |
| 149 | + { |
| 150 | + "Type": "MultiCloudRegion", |
| 151 | + "RegionUniqueName": "eu-west-2", |
| 152 | + "RegionDisplayName": "EU West (London)", |
| 153 | + "IsGlobalForRecord": false |
| 154 | + } |
| 155 | +
|
| 156 | + - RecordIdentifierInfo |
| 157 | + { |
| 158 | + "Type": "MultiCloudDiscoveryServiceDataCollector", |
| 159 | + "RecordNativeCloudUniqueIdentifier": "arn:aws:ec2:eu-west-2:123456789123:elastic-ip/eipalloc-1234abcd5678efef9", |
| 160 | + "RecordAzureUniqueIdentifier": "/subscriptions/69444886-de6b-40c5-8b43-065f739fffb9/resourcegroups/MyResourceGroupName/providers/Microsoft.Security/securityconnectors/b3113210-63f9-43c5-a6a7-f14a2a5b3cd0/securityentitydata/aws-ec2-elastic-ip-eipalloc-1234abcd5678efef9-eu-west-2", |
| 161 | + "RecordIdentifier": "eipalloc-1234abcd5678efef9-eu-west-2", |
| 162 | + "ResourceProvider": "EC2", |
| 163 | + "ResourceType": "elastic-ip" |
| 164 | + } |
| 165 | + - Record |
| 166 | + { |
| 167 | + "AllocationId": "eipalloc-1234abcd5678efef9", |
| 168 | + "AssociationId": "eipassoc-234abcd5678efef90", |
| 169 | + "CarrierIp": null, |
| 170 | + "CustomerOwnedIp": null, |
| 171 | + "CustomerOwnedIpv4Pool": null, |
| 172 | + "Domain": { |
| 173 | + "Value": "vpc" |
| 174 | + }, |
| 175 | + "InstanceId": "i-0a8fcc00493c4625d", |
| 176 | + "NetworkBorderGroup": "eu-west-2", |
| 177 | + "NetworkInterfaceId": "eni-34abcd5678efef901", |
| 178 | + "NetworkInterfaceOwnerId": "123456789123", |
| 179 | + "PrivateIpAddress": "172.31.21.88", |
| 180 | + "PublicIp": "19.218.211.431", |
| 181 | + "PublicIpv4Pool": "amazon", |
| 182 | + "Tags": [ |
| 183 | + { |
| 184 | + "Value": "arn:aws:cloudformation:eu-west-2:123456789123:stack/awseb-e-sjuh4tkr7a-stack/4ff15da0-2512-11ec-ab59-023b28e97f64", |
| 185 | + "Key": "aws:cloudformation:stack-id" |
| 186 | + }, |
| 187 | + { |
| 188 | + "Value": "e-sjuh4tkr7a", |
| 189 | + "Key": "elasticbeanstalk:environment-id" |
| 190 | + }, |
| 191 | + { |
| 192 | + "Value": "AWSEBEIP", |
| 193 | + "Key": "aws:cloudformation:logical-id" |
| 194 | + }, |
| 195 | + { |
| 196 | + "Value": "awseb-e-sjuh4tkr7a-stack", |
| 197 | + "Key": "aws:cloudformation:stack-name" |
| 198 | + }, |
| 199 | + { |
| 200 | + "Value": "Mebrennetest3-env", |
| 201 | + "Key": "elasticbeanstalk:environment-name" |
| 202 | + }, |
| 203 | + { |
| 204 | + "Value": "Mebrennetest3-env", |
| 205 | + "Key": "Name" |
| 206 | + } |
| 207 | + ] |
| 208 | + } |
| 209 | +``` |
| 210 | + |
| 211 | +> [!NOTE] |
| 212 | +> The `Record` field contains the data structure as it is returned from the AWS API. Use this field to define conditions which will determine if the resource is healthy or unhealthy. |
| 213 | +> |
| 214 | +> You can access internal properties of `Record` filed using a dot notation. For example: `| extend EncryptionType = Record.Encryption.Type`. |
| 215 | +
|
| 216 | +**Stopped EC2 instances should be removed after a specified time period** |
| 217 | + |
| 218 | +```kusto |
| 219 | +EC2_Instance |
| 220 | +| extend State = tolower(tostring(Record.State.Name.Value)) |
| 221 | +| extend StoppedTime = todatetime(tostring(Record.StateTransitionReason)) |
| 222 | +| extend HealthStatus = iff(not(State == 'stopped' and StoppedTime < ago(30d)), 'HEALTHY', 'UNHEALTHY') |
| 223 | +``` |
| 224 | + |
| 225 | +**EC2 subnets should not automatically assign public IP addresses** |
| 226 | + |
| 227 | + |
| 228 | +```kusto |
| 229 | +EC2_Subnet |
| 230 | +| extend MapPublicIpOnLaunch = tolower(tostring(Record.MapPublicIpOnLaunch)) |
| 231 | +| extend HealthStatus = iff(MapPublicIpOnLaunch == 'false' ,'HEALTHY', 'UNHEALTHY') |
| 232 | +``` |
| 233 | + |
| 234 | +**EC2 instances should not use multiple ENIs** |
| 235 | + |
| 236 | +```kusto |
| 237 | +EC2_Instance |
| 238 | +| extend NetworkInterfaces = parse_json(Record)['NetworkInterfaces'] |
| 239 | +| extend NetworkInterfaceCount = array_length(parse_json(NetworkInterfaces)) |
| 240 | +| extend HealthStatus = iff(NetworkInterfaceCount == 1 ,'HEALTHY', 'UNHEALTHY') |
| 241 | +``` |
| 242 | + |
| 243 | +You can use the following links to learn more about Kusto queries: |
| 244 | +- [KQL quick reference](/azure/data-explorer/kql-quick-reference) |
| 245 | +- [Kusto Query Language (KQL) overview](/azure/data-explorer/kusto/query/) |
| 246 | +- [Must Learn KQL](https://azurecloudai.blog/2021/11/17/must-learn-kql-part-1-tools-and-resources/) |
| 247 | + |
| 248 | +## Next steps |
| 249 | + |
| 250 | +In this article, you learned how to manage your assessments and standards in Defender for Cloud. |
| 251 | + |
| 252 | +> [!div class="nextstepaction"] |
| 253 | +> [Find recommendations that can improve your security posture](review-security-recommendations.md) |
0 commit comments