|
| 1 | +--- |
| 2 | +title: Enable Attack Disruption Actions on AWS with Microsoft Sentinel |
| 3 | +description: Enable Attack Disruption Actions on AWS with Microsoft Sentinel |
| 4 | +author: mberdugo |
| 5 | +ms.author: monaberdugo |
| 6 | +ms.reviewer: Christos Ventouris |
| 7 | +ms.date: 01/13/2026 |
| 8 | +ms.topic: how-to |
| 9 | +--- |
| 10 | + |
| 11 | +# Enable attack disruption actions on AWS with Microsoft Sentinel (preview) |
| 12 | + |
| 13 | +This article describes how to configure your AWS environment so that Microsoft Sentinel can take automated actions on a user that assumes a SAML role, or on an AWS IAM account when an alert is triggered. Attack disruption uses high-confidence signals to contain compromised assets and limit the impact of attacks, including actions on identities in AWS. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Before you begin, ensure the following: |
| 18 | + |
| 19 | +- You have an active AWS account with administrative privileges. |
| 20 | +- Your Microsoft Sentinel analytic workspace is connected to the unified security operations portal. |
| 21 | +- The AWS Connector for Microsoft Sentinel is deployed and enabled |
| 22 | +- AWS CloudTrail logs are being ingested into Microsoft Sentinel |
| 23 | + See: [Connect Microsoft Sentinel to Amazon Web Services to ingest AWS service log data](./connect-aws.md) |
| 24 | +- Appropriate IAM roles and permissions are configured in AWS to allow Microsoft Sentinel to perform actions on IAM accounts. |
| 25 | + |
| 26 | +## Step 1: Prepare AWS for integration |
| 27 | + |
| 28 | +### 1.1 Create a dedicated IAM role for Microsoft Sentinel |
| 29 | + |
| 30 | +1. In the AWS console, go to **IAM \> Roles**. |
| 31 | + |
| 32 | +1. Select **Create role**. |
| 33 | + |
| 34 | +1. Select **AWS service** as the trusted entity and choose **EC2** (you'll update the trust relationship later). |
| 35 | + |
| 36 | +1. Attach the following policy to the role (replace \<YOUR_ACCOUNT_ID\> as needed): |
| 37 | + |
| 38 | + ```json |
| 39 | + { |
| 40 | + "Version": "2012-10-17", |
| 41 | + "Statement": [ |
| 42 | + { |
| 43 | + "Effect": "Allow", |
| 44 | + "Action": [ |
| 45 | + "iam:UpdateLoginProfile", |
| 46 | + "iam:DeactivateMFADevice", |
| 47 | + "iam:DeleteAccessKey", |
| 48 | + "iam:DeleteLoginProfile", |
| 49 | + "iam:DeleteUser", |
| 50 | + "iam:RemoveUserFromGroup", |
| 51 | + "iam:ResetServiceSpecificCredential", |
| 52 | + "iam:ResyncMFADevice", |
| 53 | + "iam:RevokeSession", |
| 54 | + "iam:DeleteUserPermissionsBoundary", |
| 55 | + "iam:DeleteUserPolicy", |
| 56 | + "iam:DetachUserPolicy" |
| 57 | + ], |
| 58 | + "Resource": "arn:aws:iam::<YOUR_ACCOUNT_ID>:user/*" |
| 59 | + } |
| 60 | + ] |
| 61 | + } |
| 62 | + ``` |
| 63 | + |
| 64 | +1. Name the role (for example, SentinelAttackDisruptionRole) and create it. |
| 65 | + |
| 66 | +### 1.2 Configure trust relationship |
| 67 | + |
| 68 | +1. In the IAM role you created, go to the **Trust relationships** tab. |
| 69 | + |
| 70 | +1. Select **Edit trust relationship**. |
| 71 | + |
| 72 | +1. Replace the trust policy with the following, specifying the Microsoft Sentinel integration principal (replace `<YOUR_AZURE_SUBSCRIPTION_ID>` with your actual Azure subscription ID): |
| 73 | + |
| 74 | +```json |
| 75 | +{ |
| 76 | + "Version": "2012-10-17", |
| 77 | + "Statement": [ |
| 78 | + { |
| 79 | + "Effect": "Allow", |
| 80 | + "Principal": { |
| 81 | + "Service": "ec2.amazonaws.com", |
| 82 | + "AWS": "arn:aws:iam::<YOUR_AZURE_SUBSCRIPTION_ID>:root" |
| 83 | + }, |
| 84 | + "Action": "sts:AssumeRole" |
| 85 | + } |
| 86 | + ] |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +## Step 2: Enable CloudTrail |
| 91 | + |
| 92 | +1. In the AWS console, go to **CloudTrail**. |
| 93 | + |
| 94 | +1. Ensure that a CloudTrail is enabled and logging is active for all regions. |
| 95 | + |
| 96 | +## Step 3: Deploy and enable the AWS connector in Microsoft Sentinel |
| 97 | + |
| 98 | +1. In the Azure portal, go to **Microsoft Sentinel \> Data connectors**. |
| 99 | + |
| 100 | +1. Select **Amazon Web Services S3** from the data connectors gallery. |
| 101 | + |
| 102 | +1. If you don't see the connector, install the Amazon Web Services solution from the Content Hub in Microsoft Sentinel. |
| 103 | + |
| 104 | +1. Follow the instructions in the [official documentation](./connect-aws.md) to set up your AWS environment and connect it to Microsoft Sentinel. |
| 105 | + |
| 106 | +1. Provide the IAM role ARN and SQS queue URL as required. |
| 107 | + |
| 108 | +## Step 4: Validate integration |
| 109 | + |
| 110 | +1. In Microsoft Sentinel, confirm that the connector status is **Connected**. |
| 111 | + |
| 112 | +1. Verify log ingestion and connector health using SentinelHealth logs and AWS SQS queue status. |
| 113 | + |
| 114 | +1. In AWS, check that CloudTrail and GuardDuty events are being sent to Microsoft Sentinel. |
| 115 | + |
| 116 | +## Step 5: Test the integration |
| 117 | + |
| 118 | +1. Trigger a test alert in AWS (for example, simulated credential compromise). |
| 119 | + |
| 120 | +1. Confirm that Microsoft Sentinel can take the configured actions on the affected IAM account. |
| 121 | + |
| 122 | +1. Review audit logs in AWS and Microsoft Sentinel to verify successful execution. |
| 123 | + |
| 124 | +## Step 6: Monitor and maintain |
| 125 | + |
| 126 | +- Regularly review IAM role permissions and audit logs in AWS. |
| 127 | +- Update Microsoft Sentinel analytic rules and automation playbooks as needed to reflect changes in your AWS environment. |
| 128 | +- Monitor alerts and response actions in the Microsoft Sentinel portal. |
| 129 | + |
| 130 | +The following scripts can automate the process for building the integration with Microsoft Sentinel and AWS to enable attack disruption: |
| 131 | + |
| 132 | +### [Bash Script](#tab/bash) |
| 133 | +Save the following code snippet as a bash file and execute it. |
| 134 | + |
| 135 | +```bash |
| 136 | +#!/bin/bash |
| 137 | +# AWS Sentinel OIDC Setup Script |
| 138 | +# Configures IAM roles and policies for Microsoft Sentinel integration |
| 139 | + |
| 140 | +set -e # Exit on error |
| 141 | + |
| 142 | +# Color codes for output |
| 143 | +RED='\033[0;31m' |
| 144 | +GREEN='\033[0;32m' |
| 145 | +YELLOW='\033[1;33m' |
| 146 | +CYAN='\033[0;36m' |
| 147 | +NC='\033[0m' # No Color |
| 148 | + |
| 149 | +ms_federated_endpoint="sts.windows.net/33e01921-4d64-4f8c-a055-5bdaffd5e33d" |
| 150 | +actions_audience="api://b7c1e142-0933-4310-ba00-8b28878bfece" |
| 151 | +role_name="OIDC_Actions_Sentinel" |
| 152 | +policy_name="SentinelActionsPolicy" |
| 153 | + |
| 154 | +# Verify AWS credentials are configured |
| 155 | +echo -e "${CYAN}Verifying AWS credentials...${NC}" |
| 156 | +if ! account_id=$(aws sts get-caller-identity --query Account --output text 2>&1); then |
| 157 | + echo -e "\n${RED}ERROR: AWS credentials not configured or invalid${NC}" |
| 158 | + echo -e "${RED}Details: $account_id${NC}" |
| 159 | + echo -e "\n${YELLOW}Please authenticate using one of these methods:${NC}" |
| 160 | + echo -e "${YELLOW} 1. Run 'aws configure' to set up credentials${NC}" |
| 161 | + echo -e "${YELLOW} 2. Set AWS environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)${NC}" |
| 162 | + echo -e "${YELLOW} 3. Use 'aws sso login --profile <profile-name>' for SSO${NC}" |
| 163 | + exit 1 |
| 164 | +fi |
| 165 | +echo -e "${GREEN}✓ AWS authenticated (Account: $account_id)${NC}" |
| 166 | +trust_policy_document=$(cat << EOM |
| 167 | +{ |
| 168 | + "Statement": [ |
| 169 | + { |
| 170 | + "Effect": "Allow", |
| 171 | + "Principal": { |
| 172 | + "Federated": "arn:aws:iam::$account_id:oidc-provider/$ms_federated_endpoint/" |
| 173 | + }, |
| 174 | + "Action": "sts:AssumeRoleWithWebIdentity", |
| 175 | + "Condition": { |
| 176 | + "StringEquals": { |
| 177 | + "$ms_federated_endpoint/:aud": "$actions_audience", |
| 178 | + "sts:RoleSessionName": "MicrosoftSentinel_$account_id" |
| 179 | + } |
| 180 | + } |
| 181 | + } |
| 182 | + ] |
| 183 | +} |
| 184 | +EOM |
| 185 | +) |
| 186 | +permissions_policy_document=$(cat << EOM |
| 187 | +{ |
| 188 | + "Statement": [ |
| 189 | + { |
| 190 | + "Sid": "SentinelActionsPermissions", |
| 191 | + "Effect": "Allow", |
| 192 | + "Action": [ |
| 193 | + "iam:GetUserPolicy", |
| 194 | + "iam:DeleteRolePolicy", |
| 195 | + "iam:PutUserPolicy", |
| 196 | + "iam:AttachUserPolicy", |
| 197 | + "iam:ListUserPolicies", |
| 198 | + "iam:PutRolePolicy", |
| 199 | + "iam:GetUser", |
| 200 | + "iam:DetachUserPolicy", |
| 201 | + "iam:GetRolePolicy", |
| 202 | + "iam:DeleteUserPolicy", |
| 203 | + "s3:PutBucketPublicAccessBlock" |
| 204 | + ], |
| 205 | + "Resource": "*" |
| 206 | + } |
| 207 | + ] |
| 208 | +} |
| 209 | +EOM |
| 210 | +) |
| 211 | + |
| 212 | +aws iam add-client-id-to-open-id-connect-provider --open-id-connect-provider-arn arn:aws:iam::$account_id:oidc-provider/$ms_federated_endpoint/ --client-id $actions_audience |
| 213 | +aws iam create-role --role-name $role_name --assume-role-policy-document "$trust_policy_document" || aws iam update-assume-role-policy --role-name $role_name --policy-document "$trust_policy_document" |
| 214 | +aws iam put-role-policy --role-name $role_name --policy-name $policy_name --policy-document "$permissions_policy_document" |
| 215 | + |
| 216 | +``` |
| 217 | + |
| 218 | +### [PowerShell Script](#tab/powershell) |
| 219 | + |
| 220 | +For a PowerShell version of the script, use the following code snippet |
| 221 | + |
| 222 | +```powershell |
| 223 | +# AWS Sentinel OIDC Setup Script |
| 224 | +# Configures IAM roles and policies for Microsoft Sentinel integration |
| 225 | +
|
| 226 | +$ErrorActionPreference = 'Stop' |
| 227 | +
|
| 228 | +$ms_federated_endpoint = "sts.windows.net/33e01921-4d64-4f8c-a055-5bdaffd5e33d" |
| 229 | +$actions_audience = "api://b7c1e142-0933-4310-ba00-8b28878bfece" |
| 230 | +$role_name = "OIDC_Actions_Sentinel" |
| 231 | +$policy_name = "SentinelActionsPolicy" |
| 232 | +
|
| 233 | +# Verify AWS credentials are configured |
| 234 | +Write-Host "Verifying AWS credentials..." -ForegroundColor Cyan |
| 235 | +try { |
| 236 | + $account_id = aws sts get-caller-identity --query Account --output text 2>&1 |
| 237 | + if ($LASTEXITCODE -ne 0) { |
| 238 | + throw "AWS credentials not configured or invalid. Output: $account_id" |
| 239 | + } |
| 240 | + Write-Host "✓ AWS authenticated (Account: $account_id)" -ForegroundColor Green |
| 241 | +} catch { |
| 242 | + Write-Host "`nERROR: AWS credentials not configured or invalid" -ForegroundColor Red |
| 243 | + Write-Host "Details: $($_.Exception.Message)" -ForegroundColor Red |
| 244 | + Write-Host "`nPlease authenticate using one of these methods:" -ForegroundColor Yellow |
| 245 | + Write-Host " 1. Run 'aws configure' to set up credentials" -ForegroundColor Yellow |
| 246 | + Write-Host " 2. Set AWS environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)" -ForegroundColor Yellow |
| 247 | + Write-Host " 3. Use 'aws sso login --profile <profile-name>' for SSO" -ForegroundColor Yellow |
| 248 | + exit 1 |
| 249 | +} |
| 250 | +
|
| 251 | +# Define trust policy document |
| 252 | +$trust_policy_document = @" |
| 253 | +{ |
| 254 | + "Statement": [ |
| 255 | + { |
| 256 | + "Effect": "Allow", |
| 257 | + "Principal": { |
| 258 | + "Federated": "arn:aws:iam::$account_id:oidc-provider/$ms_federated_endpoint/" |
| 259 | + }, |
| 260 | + "Action": "sts:AssumeRoleWithWebIdentity", |
| 261 | + "Condition": { |
| 262 | + "StringEquals": { |
| 263 | + "$ms_federated_endpoint/:aud": "$actions_audience", |
| 264 | + "sts:RoleSessionName": "MicrosoftSentinel_$account_id" |
| 265 | + } |
| 266 | + } |
| 267 | + } |
| 268 | + ] |
| 269 | +} |
| 270 | +"@ |
| 271 | +
|
| 272 | +# Define permissions policy document |
| 273 | +$permissions_policy_document = @" |
| 274 | +{ |
| 275 | + "Statement": [ |
| 276 | + { |
| 277 | + "Sid": "SentinelActionsPermissions", |
| 278 | + "Effect": "Allow", |
| 279 | + "Action": [ |
| 280 | + "iam:GetUserPolicy", |
| 281 | + "iam:DeleteRolePolicy", |
| 282 | + "iam:PutUserPolicy", |
| 283 | + "iam:AttachUserPolicy", |
| 284 | + "iam:ListUserPolicies", |
| 285 | + "iam:PutRolePolicy", |
| 286 | + "iam:GetUser", |
| 287 | + "iam:DetachUserPolicy", |
| 288 | + "iam:GetRolePolicy", |
| 289 | + "iam:DeleteUserPolicy", |
| 290 | + "s3:PutBucketPublicAccessBlock" |
| 291 | + ], |
| 292 | + "Resource": "*" |
| 293 | + } |
| 294 | + ] |
| 295 | +} |
| 296 | +"@ |
| 297 | +
|
| 298 | +# Add client ID to OpenID Connect provider |
| 299 | +Write-Host "`nAdding client ID to OIDC provider..." -ForegroundColor Cyan |
| 300 | +try { |
| 301 | + $output = aws iam add-client-id-to-open-id-connect-provider ` |
| 302 | + --open-id-connect-provider-arn "arn:aws:iam::$account_id:oidc-provider/$ms_federated_endpoint/" ` |
| 303 | + --client-id $actions_audience 2>&1 |
| 304 | + if ($LASTEXITCODE -ne 0) { throw $output } |
| 305 | + Write-Host "✓ Client ID added successfully" -ForegroundColor Green |
| 306 | +} catch { |
| 307 | + Write-Host "ERROR: Failed to add client ID to OIDC provider" -ForegroundColor Red |
| 308 | + Write-Host "Details: $($_.Exception.Message)" -ForegroundColor Red |
| 309 | + exit 1 |
| 310 | +} |
| 311 | +
|
| 312 | +# Create or update IAM role |
| 313 | +Write-Host "`nCreating/updating IAM role..." -ForegroundColor Cyan |
| 314 | +try { |
| 315 | + $output = aws iam create-role ` |
| 316 | + --role-name $role_name ` |
| 317 | + --assume-role-policy-document $trust_policy_document 2>&1 |
| 318 | + if ($LASTEXITCODE -eq 0) { |
| 319 | + Write-Host "✓ Role created successfully" -ForegroundColor Green |
| 320 | + } else { |
| 321 | + throw $output |
| 322 | + } |
| 323 | +} catch { |
| 324 | + if ($_.Exception.Message -like "*EntityAlreadyExists*") { |
| 325 | + Write-Host "Role already exists, updating assume role policy..." -ForegroundColor Yellow |
| 326 | + try { |
| 327 | + $output = aws iam update-assume-role-policy ` |
| 328 | + --role-name $role_name ` |
| 329 | + --policy-document $trust_policy_document 2>&1 |
| 330 | + if ($LASTEXITCODE -ne 0) { throw $output } |
| 331 | + Write-Host "✓ Assume role policy updated" -ForegroundColor Green |
| 332 | + } catch { |
| 333 | + Write-Host "ERROR: Failed to update assume role policy" -ForegroundColor Red |
| 334 | + Write-Host "Details: $($_.Exception.Message)" -ForegroundColor Red |
| 335 | + exit 1 |
| 336 | + } |
| 337 | + } else { |
| 338 | + Write-Host "ERROR: Failed to create IAM role" -ForegroundColor Red |
| 339 | + Write-Host "Details: $($_.Exception.Message)" -ForegroundColor Red |
| 340 | + exit 1 |
| 341 | + } |
| 342 | +} |
| 343 | +
|
| 344 | +# Attach inline policy to role |
| 345 | +Write-Host "`nAttaching policy to role..." -ForegroundColor Cyan |
| 346 | +try { |
| 347 | + $output = aws iam put-role-policy ` |
| 348 | + --role-name $role_name ` |
| 349 | + --policy-name $policy_name ` |
| 350 | + --policy-document $permissions_policy_document 2>&1 |
| 351 | + if ($LASTEXITCODE -ne 0) { throw $output } |
| 352 | + Write-Host "✓ Policy attached successfully" -ForegroundColor Green |
| 353 | +} catch { |
| 354 | + Write-Host "ERROR: Failed to attach policy to role" -ForegroundColor Red |
| 355 | + Write-Host "Details: $($_.Exception.Message)" -ForegroundColor Red |
| 356 | + exit 1 |
| 357 | +} |
| 358 | +
|
| 359 | +Write-Host "`n========================================" -ForegroundColor Green |
| 360 | +Write-Host "Setup completed successfully!" -ForegroundColor Green |
| 361 | +Write-Host "========================================" -ForegroundColor Green |
| 362 | +Write-Host "Role ARN: arn:aws:iam::$account_id:role/$role_name" -ForegroundColor Cyan |
| 363 | +``` |
| 364 | + |
| 365 | +--- |
| 366 | + |
| 367 | +## Related content |
| 368 | + |
| 369 | +- [Connect Microsoft Sentinel to Amazon Web Services to ingest AWS service log data](./connect-aws.md) |
| 370 | +- [Microsoft Sentinel data connectors](./data-connectors-reference.md#sentinel-data-connectors) |
0 commit comments