---
title: Enabling Agentless Scanning
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Cloud Security > Setting up Cloud Security > Cloud
  Security Agentless Scanning > Enabling Agentless Scanning
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Enabling Agentless Scanning

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

Agentless Scanning provides visibility into vulnerabilities that exist within your cloud infrastructure, without installing the Datadog Agent. You can run Agentless Scanning in one of two modes:

- **Datadog-hosted (SaaS)**: Datadog runs the scanners in its own infrastructure. You attach scanning permissions to your existing Datadog AWS integration role, and you don't deploy any scanner infrastructure. Supports AWS only.
- **Self-hosted**: You deploy the scanners in your own cloud account, where they read your disk contents and send only scan results to Datadog. Supports AWS, Azure, and Google Cloud.

Both modes use the same scanning engine and produce the same findings. To compare them, see [Choose where scanners run](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning.md#choose-where-scanners-run). Select your cloud provider and scanner hosting mode in the filters at the top of this page to see the setup instructions. Datadog-hosted scanning is available for AWS only.

{% section displayed-if="Scanner hosting is Self-hosted" %}
This section only applies to users who meet the following criteria: Scanner hosting is Self-hosted

Self-hosted scanners run entirely within your infrastructure, so sensitive data stays in your environment. Because scanning runs in your cloud account, standard [cloud provider costs](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning.md#cloud-service-provider-cost) apply. To learn more, see the [Agentless Scanning overview](https://docs.datadoghq.com/security/cloud_security_management/agentless_scanning.md).

Setup takes approximately 30 minutes per cloud account:

1. Verify prerequisites below.
1. Choose your cloud provider and deployment method.
1. Launch a template in your cloud account.
1. Verify scan results in Datadog.
{% /section %}

{% section displayed-if="Scanner hosting is Datadog-hosted (SaaS)" %}
This section only applies to users who meet the following criteria: Scanner hosting is Datadog-hosted (SaaS)

{% callout %}
##### Datadog-hosted (SaaS) Agentless Scanning is in Preview


Datadog-hosted scanning supports AWS accounts only. To scan Azure subscriptions or Google Cloud projects, select Azure or Google Cloud in the Cloud provider filter at the top of this page.




[Request Access](https://www.datadoghq.com/product-preview/agentless-saas-mode/)
{% /callout %}

Attach the Agentless Scanning permissions to the Datadog integration role in each AWS account you want to scan. Datadog runs the scans, and you don't deploy, update, or pay for any scanner infrastructure in your account.

Datadog reads your disk contents in its scanning environment, in the region of your Datadog site, and doesn't retain them. If you enable Sensitive Data Scanner, Datadog also reads the contents of your Amazon S3 buckets in its scanning environment. Before you begin, review [Datadog-hosted data residency](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning.md#datadog-hosted-data-residency).
{% /section %}

## Prerequisites{% #prerequisites %}

{% section displayed-if="Scanner hosting is Self-hosted" %}
This section only applies to users who meet the following criteria: Scanner hosting is Self-hosted

Before setting up Agentless Scanning, verify that the following prerequisites are met:

- **Remote Configuration**: [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) must be enabled on your Datadog organization to send scan instructions to Agentless scanners.
- **[API and Application Keys](https://docs.datadoghq.com/account_management/api-app-keys.md)**:
  - An API key with Remote Configuration enabled is required for scanners to report scan results to Datadog.
  - An Application key with either `Integrations Manage` or `Org Management` permissions is required for you to enable scanning features through the Datadog API.
- **Cloud permissions**: The Agentless Scanning instance requires specific permissions to scan hosts, host images, container registries, and functions. Datadog automatically applies these permissions, listed below for transparency, during installation.

{% section displayed-if="Cloud provider is AWS" %}
This section only applies to users who meet the following criteria: Cloud provider is AWS

{% collapsible-section %}
### AWS scanning permissions

Scanning permissions:

- `ebs:GetSnapshotBlock`
- `ebs:ListChangedBlocks`
- `ebs:ListSnapshotBlocks`
- `ec2:CopySnapshot`
- `ec2:CreateSnapshot`
- `ec2:CreateTags`
- `ec2:DeleteSnapshot`
- `ec2:DeregisterImage`
- `ec2:DescribeImages`
- `ec2:DescribeSnapshots`
- `ec2:DescribeVolumes`
- `ecr:BatchGetImage`
- `ecr:GetAuthorizationToken`
- `ecr:GetDownloadUrlForLayer`
- `kms:CreateGrant`
- `kms:Decrypt`
- `kms:DescribeKey`
- `lambda:GetFunction`
- `lambda:GetLayerVersion`

Only when Sensitive Data Scanning (DSPM) is enabled:

- `kms:GenerateDataKey`
- `s3:GetObject`
- `s3:ListBucket`

{% /collapsible-section %}
{% /section %}

{% section displayed-if="Cloud provider is Azure" %}
This section only applies to users who meet the following criteria: Cloud provider is Azure

{% collapsible-section %}
### Azure scanning permissions

- `Microsoft.Compute/virtualMachines/read`
- `Microsoft.Compute/virtualMachines/instanceView/read`
- `Microsoft.Compute/virtualMachineScaleSets/read`
- `Microsoft.Compute/virtualMachineScaleSets/instanceView/read`
- `Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read`
- `Microsoft.Compute/virtualMachineScaleSets/virtualMachines/instanceView/read`
- `Microsoft.Compute/disks/read`
- `Microsoft.Compute/disks/beginGetAccess/action`
- `Microsoft.Compute/disks/endGetAccess/action`
- `Microsoft.Compute/galleries/images/versions/read`
- `Microsoft.ContainerRegistry/registries/pull/read`
- `Microsoft.ContainerRegistry/registries/repositories/content/read` (data action)
- `Microsoft.Web/sites/read`
- `Microsoft.Web/sites/publish/Action`

{% /collapsible-section %}
{% /section %}

{% section displayed-if="Cloud provider is Google Cloud" %}
This section only applies to users who meet the following criteria: Cloud provider is Google Cloud

{% collapsible-section %}
### Google Cloud scanning permissions

- `compute.disks.create`
- `compute.disks.createSnapshot`
- `compute.disks.delete`
- `compute.disks.get`
- `compute.disks.setLabels`
- `compute.disks.use`
- `compute.globalOperations.get`
- `compute.images.get`
- `compute.instances.attachDisk`
- `compute.instances.detachDisk`
- `compute.snapshots.create`
- `compute.snapshots.get`
- `compute.snapshots.list`
- `compute.snapshots.delete`
- `compute.snapshots.setLabels`

{% /collapsible-section %}
{% /section %}
{% /section %}

{% section displayed-if="Scanner hosting is Datadog-hosted (SaaS)" %}
This section only applies to users who meet the following criteria: Scanner hosting is Datadog-hosted (SaaS)

Before setting up Agentless Scanning, verify that the following prerequisites are met:

- **AWS integration**: The AWS account you want to scan is integrated with Datadog through the [Datadog AWS integration](https://docs.datadoghq.com/integrations/amazon_web_services.md). Datadog uses the integration's IAM role to scan your account.
- **[API and Application Keys](https://docs.datadoghq.com/account_management/api-app-keys.md)**: An API key and an Application key for your Datadog organization.
- **Cloud permissions**: Setup attaches a managed IAM policy with the following permissions, and the AWS managed `SecurityAudit` policy, to the Datadog integration role. The CloudFormation stack also creates a Lambda function and its IAM execution role, which the stack uses to call the Datadog API during deployment. Setup doesn't create any scanner compute or networking resources in your account.

{% collapsible-section %}
### Datadog-hosted (SaaS) Agentless Scanning permissions

- `ebs:GetSnapshotBlock`
- `ebs:ListChangedBlocks`
- `ebs:ListSnapshotBlocks`
- `ec2:CopySnapshot`
- `ec2:CreateSnapshot`
- `ec2:CreateTags`
- `ec2:DeleteSnapshot`
- `ec2:DeregisterImage`
- `ec2:DescribeSnapshots`
- `ec2:DescribeVolumes`
- `ecr:BatchGetImage`
- `ecr:GetAuthorizationToken`
- `ecr:GetDownloadUrlForLayer`
- `kms:CreateGrant`
- `kms:Decrypt`
- `kms:DescribeKey`
- `kms:GenerateDataKey`
- `lambda:GetFunction`
- `lambda:GetLayerVersion`
- `s3:GetObject`
- `s3:ListBucket`

For the full policy, including resource and condition scoping, see the [Datadog-hosted IAM policy](https://github.com/DataDog/cloudformation-template/blob/master/aws_quickstart/datadog_agentless_saas_policy.json).
{% /collapsible-section %}
{% /section %}

## Setup{% #setup %}

{% section displayed-if="Scanner hosting is Self-hosted" %}
This section only applies to users who meet the following criteria: Scanner hosting is Self-hosted

See [Deploying Agentless Scanning](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning/deployment_methods.md?agentless_scanner_hosting=self_hosted) for information on how to structure your deployment, including how many accounts and how many regions you deploy scanners across.

Select your cloud provider in the Cloud provider filter at the top of this page to see the available setup methods. If you are setting up Agentless Scanning across multiple cloud providers, complete the setup for each provider independently.

### Choose your setup{% #choose-your-setup %}

{% section displayed-if="Cloud provider is AWS" %}
This section only applies to users who meet the following criteria: Cloud provider is AWS

- **New to Datadog**: On the [Intro to Cloud Security](https://app.datadoghq.com/security/csm/) page, click Get Started with Cloud Security, then click Quick Start. Quick Start is a guided setup flow that uses AWS CloudFormation to deploy Agentless Scanning with all Cloud Security features pre-enabled. It is only available for organizations that have not yet set up Cloud Security Management.
- **Single AWS account in Datadog**: Use the **CloudFormation** or **Terraform** tab. Terraform is recommended for multi-region deployments.
- **AWS organization with multiple accounts**: Use the **CloudFormation StackSet** tab to deploy scanning capabilities across all member accounts.
- **Multiple accounts without AWS Organizations**: Repeat the **CloudFormation** or **Terraform** setup for each account individually.

{% tab title="CloudFormation" %}
Use CloudFormation if you already have an AWS account integrated with Datadog and want to enable Agentless Scanning, or if you want to add a new AWS account.

#### New AWS account{% #cloudformation-new-aws-account %}

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > AWS.
1. At the bottom of the AWS section, click Add AWS accounts by following these steps. The Add New AWS Account(s) dialog is displayed.
1. Select the Add a Single AWS Account and CloudFormation options.
1. Select the AWS region where you want to create the CloudFormation stack.
1. Select an API key that has [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) enabled.
1. Choose whether to enable Sensitive Data Scanner for cloud storage. This automatically catalogs and classifies sensitive data in Amazon S3 resources.
1. Click Launch CloudFormation Template. A new window opens, displaying the AWS CloudFormation screen. Use the provided CloudFormation template to create a stack. The template includes the IAM permissions required to deploy and manage Agentless scanners.

#### Existing AWS account{% #cloudformation-existing-aws-account %}

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > AWS.
1. Click the row of the AWS account where you want to deploy the Agentless scanner to open the side panel. Clicking the account ID opens the AWS integration page in a new tab instead.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. In the modal, specify the following options:
   - How would you like to set up Agentless scanning?: Select CloudFormation.
   - Select AWS Region: Select the AWS region where you want to create the CloudFormation stack.
   - Add Datadog API Key: Select an API key that has [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) enabled.
   - Create Application Key: Click Create.
   - Choose Scanning Method: Select Deploy a new scanner, or select Use an existing scanner and then select the scanner you want to use.
   - Enable Features: Enable Agentless Vulnerability management is always on. Optionally, turn on Enable Code Locations and Data Security or Enable CIS Host (Linux) Benchmarks.
1. Click Launch CloudFormation Template. A new window opens, displaying the AWS CloudFormation screen. Use the provided CloudFormation template to create a stack.
1. Click Done.

{% /tab %}

{% tab title="CloudFormation StackSet (multi-account)" %}
For AWS Organizations with multiple accounts, use a CloudFormation StackSet to deploy the Agentless Scanning delegate role across all member accounts. This approach automates onboarding and configures new accounts added to your AWS Organization.

This setup deploys the delegate role required for [cross-account scanning](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning/deployment_methods.md?agentless_scanner_hosting=self_hosted) across your AWS Organization or specific Organizational Units (OUs). First, set up Agentless Scanning in your central scanning account using the **CloudFormation** or **Terraform** tab, then deploy the StackSet to configure the remaining accounts.

#### Prerequisites{% #stackset-prerequisites %}

- Access to the AWS management account
- [Trusted Access with AWS Organizations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-enable-trusted-access.html) must be enabled for CloudFormation StackSets
- Agentless Scanning already configured in your central scanning account (see the **CloudFormation** tab)

#### Deploy the StackSet{% #deploy-the-stackset %}

1. Log in to your AWS management account and navigate to CloudFormation > StackSets.

1. Click Create StackSet.

1. Select Service-managed permissions.

1. Under Specify template, select Amazon S3 URL and enter the following URL:

   ```
   https://datadog-cloudformation-template-quickstart.s3.amazonaws.com/aws/v4.22.1/datadog_agentless_delegate_role_stackset.yaml
   ```

1. Enter a StackSet name (for example, `DatadogAgentlessScanningStackSet`).

1. Configure the ScannerInstanceRoleARN parameter, which is the ARN of the IAM role attached to your Agentless scanner instances.
Important alert (level: danger): 
The `ScannerInstanceRoleARN` must be the exact ARN of the scanner instance role (for example, `arn:aws:iam::123456789012:role/DatadogAgentlessScannerRole`). Using a root ARN such as `arn:aws:iam::123456789012:root` does not work.

The `ScannerInstanceRoleARN` establishes a trust relationship between the delegate role (created in target accounts) and your scanner instances (already running in the central account). This enables cross-account scanning where:

   - The scanner runs in Account 4.
   - The delegate role exists in Accounts 1, 2, 3 (deployed through the StackSet).
   - The scanner assumes the delegate roles to scan resources in those accounts.

1. Set Deployment targets to deploy across your AWS Organization or specific OUs.

1. Enable Automatic deployment to configure new accounts added to your AWS Organization.

1. Select a single region for deployment (the IAM role is global and only needs to be deployed once per account).

1. Review and submit the StackSet.

After the StackSet deploys, the member accounts are configured to allow cross-account scanning from your central scanner account.
{% /tab %}

{% tab title="Terraform" %}
The [Terraform Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner) provides a reusable configuration for installing the Datadog Agentless scanner. Terraform is the recommended deployment method for multi-region environments. It deploys one scanner per region, which avoids cross-region networking costs. For guidance on choosing your deployment topology, see [Deploying Agentless Scanning](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning/deployment_methods.md?agentless_scanner_hosting=self_hosted). For usage examples including multi-region configurations, see the [examples directory](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/examples) in the GitHub repository.

#### New AWS account{% #terraform-new-aws-account %}

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > AWS.
1. At the bottom of the AWS section, click Add AWS accounts by following these steps. The Add New AWS Account(s) dialog is displayed.
1. Select the Add a Single AWS Account and Manually options.
1. Follow the instructions for installing the [Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/blob/main/README.md).
1. Select the I confirm that the Datadog IAM Role has been added to the AWS Account checkbox.
1. Enter the AWS Account ID and AWS Role Name.
1. Click Save.

#### Existing AWS account{% #terraform-existing-aws-account %}

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > AWS.
1. Click the AWS account where you want to deploy the Agentless scanner to open the side panel.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. In the How would you like to set up Agentless scanning? section, select Terraform.
1. Follow the instructions for installing the [Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/blob/main/README.md).
1. Select the I confirm the Datadog Agentless Scanner was installed using Terraform checkbox.
1. Click Done.

{% /tab %}

After completing any of the setup methods above, verify your setup.
{% /section %}

{% section displayed-if="Cloud provider is Azure" %}
This section only applies to users who meet the following criteria: Cloud provider is Azure

- **New Azure customer**: Set up the [Datadog Azure integration](https://app.datadoghq.com/security/configuration/csm/setup?active_steps=cloud-accounts&active_sub_step=azure) first, then enable Agentless Scanning.
- **Existing integrated Azure subscription**: Use the **Cloud Shell** (recommended), **Azure Resource Manager**, or **Terraform** tab.
- **Multiple subscriptions**: Use **Cloud Shell** for repeatable, multi-subscription deployments. **Terraform** is also available if you prefer to manage your own infrastructure-as-code.

{% alert level="info" %}
If you haven't connected your Azure subscription to Datadog yet, [set up the Azure integration](https://app.datadoghq.com/security/configuration/csm/setup?active_steps=cloud-accounts&active_sub_step=azure) first.
{% /alert %}

{% tab title="Cloud Shell" %}
Use Azure Cloud Shell to set up Agentless Scanning for your Azure subscriptions. This method downloads a [setup script](https://github.com/DataDog/integrations-management/tree/main/azure/agentless) that wraps the [Terraform Datadog Agentless Scanner module for Azure](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/azure#readme), so you do not need to manage Terraform directly. You can review the script before running it.

1. Ensure the identity you use in Cloud Shell has the required Azure permissions:

   - On the **scanner subscription**, the identity must have a role that grants role-assignment write and resource creation, such as **Owner**.
   - On **each scanned subscription**, the identity must have a role that grants the `Microsoft.Authorization/roleAssignments/write` permission, so the scanner's managed identity can be granted the permissions it needs to snapshot and read disks, such as **User Access Administrator** or **Owner**.

Before you run the generated command, note what the setup script does in Azure:

   - **Terraform state**: By default, it creates an Azure Storage Account in the **scanner** subscription. To reuse an existing storage account in the scanner resource group instead, set `TF_STATE_STORAGE_ACCOUNT` before you run the command; the script does not create a new account when that variable is set.
   - **Resource providers**: When possible, it registers these resource providers in the scanner subscription: `Microsoft.Compute`, `Microsoft.Network`, `Microsoft.ManagedIdentity`, `Microsoft.Storage`, `Microsoft.KeyVault`, `Microsoft.Authorization`.

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > Azure.

1. Click the Azure subscription where you want to deploy the Agentless scanner, which opens the side panel.

1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.

1. In the How would you like to set up Agentless scanning? section, select Cloud Shell.

1. Select an API key that has [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) enabled. An application key is automatically generated.

1. Select the Azure subscriptions you want to scan.

1. Configure the scanner:

   - If you already have scanners deployed, you can choose to use an existing scanner (recommended) or deploy a new scanner.
   - If you choose deploy a new scanner, select the scanner subscription (which must be one of the selected subscriptions) and the scanner locations (Azure regions, up to four). Datadog recommends deploying scanners in every region where you have more than 150 hosts.

1. Click Copy command to copy the generated command, and click Open Azure Cloud Shell to open [Azure Cloud Shell](https://shell.azure.com). Review and run the command. The script applies the [Terraform Datadog Agentless Scanner module for Azure](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/azure#readme) to deploy and configure the scanner in your selected subscription and location(s).

1. After the command completes, return to the Datadog setup page and click Done.

{% /tab %}

{% tab title="Azure Resource Manager" %}
Use the Azure Resource Manager template to deploy the Agentless Scanner. The template includes the role definitions required to deploy and manage Agentless scanners.

#### New Azure subscription{% #new-azure-subscription %}

{% alert level="info" %}
Ensure you have the [Datadog Azure integration](https://docs.datadoghq.com/integrations/guide/azure-manual-setup.md?tab=azurecli) set up.
{% /alert %}

Complete the following steps to enable Agentless Scanning for your Azure subscriptions:

##### Cloud Security Setup page{% #cloud-security-setup-page %}

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > Azure.
1. Locate the tenant ID of your subscription.
1. **(Optional)** To enable detection of misconfigurations, toggle Posture Management to the on position.
1. Expand the list of Azure subscriptions and locate the subscription where you want to deploy the Agentless scanner.
1. Click the subscription where you want to deploy the Agentless scanner to open the side panel.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. Under How would you like to set up Agentless scanning?, select Azure Resource Manager.
1. Select an API key that has [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) enabled.
1. Select an application key.
1. Click Launch Azure Resource Manager to be redirected to the Azure portal.

##### Azure portal{% #azure-portal %}

1. Log in to the Azure portal. The template creation form is displayed.
1. Select the subscription and the resource group in which the Agentless scanners are to be deployed. Datadog recommends that you deploy the Datadog Agentless Scanner in a dedicated resource group.
1. In Subscriptions to scan, select all the subscriptions you want to scan.
1. Enter your Datadog API Key, select your Datadog Site, and fill out the remainder of the form.
1. Click Review + create.

#### Existing Azure subscription{% #existing-azure-subscription %}

Complete the following steps to enable Agentless Scanning for your Azure subscriptions:

##### Cloud Security Setup page{% #cloud-security-setup-page-2 %}

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > Azure.
1. Locate the tenant ID of your subscription.
1. **(Optional)** To enable detection of misconfigurations, toggle Posture Management to the on position.
1. Expand the list of Azure subscriptions and locate the subscription where you want to deploy the Agentless scanner.
1. Click the subscription where you want to deploy the Agentless scanner to open the side panel.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. Under How would you like to set up Agentless scanning?, select Azure Resource Manager.
1. Select an API key that has [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) enabled.
1. Select an application key.
1. Click Launch Azure Resource Manager to be redirected to the Azure portal.

##### Azure portal{% #azure-portal-2 %}

1. Log in to the Azure portal. The template creation form is displayed.
1. Select the subscription and the resource group in which the Agentless scanners are to be deployed. Datadog recommends that you deploy the Datadog Agentless Scanner in a dedicated resource group.
1. In Subscriptions to scan, select all the subscriptions you want to scan.
1. Enter your Datadog API Key, select your Datadog Site, and fill out the remainder of the form.
1. Click Review + create.

{% /tab %}

{% tab title="Terraform" %}
The [Terraform Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner) provides a reusable configuration for installing the Datadog Agentless scanner. For guidance on choosing your deployment topology, see [Deploying Agentless Scanning](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning/deployment_methods.md?agentless_scanner_hosting=self_hosted). For usage examples, see the [examples directory](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/examples) in the GitHub repository.

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > Azure.
1. Click the Azure subscription where you want to deploy the Agentless scanner, which opens the side panel.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. In the How would you like to set up Agentless scanning? section, select Terraform.
1. Follow the instructions for installing the [Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/azure#readme).
1. Click Done.

{% /tab %}

After completing any of the setup methods above, verify your setup.
{% /section %}

{% section displayed-if="Cloud provider is Google Cloud" %}
This section only applies to users who meet the following criteria: Cloud provider is Google Cloud

- **New Google Cloud customer**: [Set up the Google Cloud integration](https://app.datadoghq.com/security/configuration/csm/setup?active_steps=cloud-accounts&active_sub_step=gcp) first, then enable Agentless Scanning.
- **Existing integrated Google Cloud project**: Use the **Cloud Shell** (recommended) or **Terraform** tab.

{% alert level="info" %}
If you haven't connected your Google Cloud project to Datadog yet, [set up the Google Cloud integration](https://app.datadoghq.com/security/configuration/csm/setup?active_steps=cloud-accounts&active_sub_step=gcp) first.
{% /alert %}

{% tab title="Cloud Shell" %}
Use Google Cloud Shell to set up Agentless Scanning for your Google Cloud projects. This method downloads a [setup script](https://github.com/DataDog/integrations-management/tree/main/gcp/agentless) that wraps the [Terraform Datadog Agentless Scanner module for Google Cloud](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/gcp#readme), so you do not need to manage Terraform directly. You can review the script before running it.

1. Verify that you have the required Google Cloud permissions:

   - On the **scanner project**, the identity you use in Cloud Shell must have **Owner** or equivalent.
   - **Storage**: Include permission to create Terraform state storage in the scanner project, or to use an existing bucket that you reference with `TF_STATE_BUCKET` (for example, `roles/storage.admin`, or the `storage.buckets.create`, `storage.buckets.get`, and `storage.buckets.update` permissions).

Before you run the generated command, note what the setup script does in Google Cloud:

   - **Terraform state**: By default, it creates a GCS bucket in the **scanner** project. To reuse an existing bucket, set `TF_STATE_BUCKET` before you run the command; the script does not create a bucket when that variable is set.
   - If you see a 403 error on Setting up Terraform state storage, see [Google Cloud: Failed to create state bucket](https://docs.datadoghq.com/security/cloud_security_management/troubleshooting/agentless_scanning.md#gcp-failed-to-create-state-bucket-storagebucketscreate-403) in the troubleshooting guide.

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > GCP.

1. Click the Google Cloud project where you want to deploy the Agentless scanner, which opens the side panel.

1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.

1. In the How would you like to set up Agentless scanning? section, select Cloud Shell.

1. Select an API key that has [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) enabled. An application key is automatically generated.

1. Select the GCP projects you want to scan.

1. Configure the scanner:

   - If you already have scanners deployed, you can choose to use an existing scanner (recommended) or deploy a new scanner.
   - If you choose deploy a new scanner, select the scanner project (which must be one of the selected projects) and the scanner regions. Datadog recommends installing scanners in every region where you have more than 150 hosts.

1. Click Copy command to copy the generated command, and click Open Google Cloud Shell to open [Google Cloud Shell](https://ssh.cloud.google.com/cloudshell). Review and run the command. The script applies the [Terraform Datadog Agentless Scanner module for Google Cloud](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/gcp#readme) to deploy and configure the scanner in your selected project and region(s).

1. After the command completes, return to the Datadog setup page and click Done.

{% /tab %}

{% tab title="Terraform" %}
The [Terraform Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner) provides a reusable configuration for installing the Datadog Agentless scanner. For guidance on choosing your deployment topology, see [Deploying Agentless Scanning](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning/deployment_methods.md?agentless_scanner_hosting=self_hosted). For usage examples, see the [examples directory](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/examples) in the GitHub repository.

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > GCP.
1. Click the Google Cloud project where you want to deploy the Agentless scanner, which opens the side panel.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. In the How would you like to set up Agentless scanning? section, select Terraform.
1. Follow the instructions for installing the [Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/gcp#readme).
1. Click Done.

{% /tab %}

After completing any of the setup methods above, verify your setup.
{% /section %}
{% /section %}

{% section displayed-if="Scanner hosting is Datadog-hosted (SaaS)" %}
This section only applies to users who meet the following criteria: Scanner hosting is Datadog-hosted (SaaS)

To enable scanning for an AWS account, attach the Agentless Scanning permissions to the Datadog integration role in that account. You can attach the permissions with a CloudFormation stack, a CloudFormation StackSet, or Terraform.

### Choose your setup{% #datadog-hosted-choose-your-setup %}

- **Single AWS account in Datadog**: Use the **CloudFormation** or **Terraform** tab.
- **AWS organization with multiple accounts**: Use the **CloudFormation StackSet** tab to attach the scanning permissions across all member accounts.
- **Multiple accounts without AWS Organizations**: Repeat the **CloudFormation** or **Terraform** setup for each account individually.

{% tab title="CloudFormation" %}
The [Datadog-hosted CloudFormation template](https://github.com/DataDog/cloudformation-template/blob/master/aws_quickstart/datadog_agentless_saas.yaml) attaches a managed IAM policy with the scanning permissions, and the AWS managed `SecurityAudit` policy, to your Datadog integration role. The stack also creates a Lambda function and its IAM execution role, which call the Datadog API during deployment.

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > AWS.
1. Open the AWS account you want to scan:
   - **Account already integrated with Datadog**: Click the account's row to open the side panel. Clicking the account ID opens the AWS integration page in a new tab instead.
   - **New AWS account**: At the bottom of the AWS section, click Add AWS accounts by following these steps and complete the [AWS integration](https://docs.datadoghq.com/integrations/amazon_web_services.md) setup. Then, click the new account's row to open the side panel.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. In the modal, specify the following options:
   - How would you like to set up Agentless scanning?: Select CloudFormation.
   - Select AWS Region: Select the AWS region where you want to create the CloudFormation stack.
   - Add Datadog API Key: Select an API key, or keep the key that's already selected.
   - Create Application Key: Click Create.
   - Choose Scanning Method: Select Datadog-hosted (SaaS).
   - Enable Features: Enable Agentless Vulnerability management is always on. Optionally, turn on Enable Code Locations and Data Security or Enable CIS Host (Linux) Benchmarks.
1. Click Launch CloudFormation Template. A new window opens, displaying the AWS CloudFormation screen. Use the provided CloudFormation template to create a stack.
1. Click Done.

The CloudFormation stack uses the following parameters:

- `DatadogAPIKey` and `DatadogAPPKey`: Your Datadog API key and application key.
- `DatadogSite`: Your Datadog site (<YOUR_DATADOG_SITE>).
- `DatadogIntegrationRoleName`: The name of the IAM role that the Datadog AWS integration uses in this account.
- `AgentlessVulnerabilityScanning`: Set to `true` to scan hosts, containers, and Lambda functions for vulnerabilities.
- `AgentlessSensitiveDataScanning`: Set to `true` to scan Amazon S3 buckets with [Sensitive Data Scanner](https://docs.datadoghq.com/security/sensitive_data_scanner/setup/cloud_storage.md).
- `AgentlessComplianceHostScanning`: Set to `true` to scan hosts for compliance.

{% /tab %}

{% tab title="CloudFormation StackSet (multi-account)" %}
For AWS Organizations with multiple accounts, use a CloudFormation StackSet to attach the Agentless Scanning permissions to the Datadog integration role in all member accounts. This approach automates onboarding and configures new accounts added to your AWS Organization.

#### Additional prerequisites for StackSet{% #datadog-hosted-stackset-prerequisites %}

- Access to the AWS management account
- [Trusted Access with AWS Organizations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-enable-trusted-access.html) must be enabled for CloudFormation StackSets
- Every member account is integrated with Datadog through the [Datadog AWS integration](https://docs.datadoghq.com/integrations/amazon_web_services.md)

#### Deploy the StackSet{% #datadog-hosted-deploy-the-stackset %}

1. Log in to your AWS management account and navigate to CloudFormation > StackSets.
1. Click Create StackSet.
1. Select Service-managed permissions.
1. Under Specify template, select Amazon S3 URL and enter the Datadog-hosted StackSet template URL.
1. Enter a StackSet name (for example, `DatadogAgentlessScanningStackSet`).
1. Set Deployment targets to deploy across your AWS Organization or specific OUs.
1. Enable Automatic deployment to configure new accounts added to your AWS Organization.
1. Select a single region for deployment (IAM is global, so the permissions only need to be deployed once per account).
1. Review and submit the StackSet.

{% /tab %}

{% tab title="Terraform" %}
The [Datadog-hosted (SaaS) Terraform example](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/tree/main/examples/saas) in the [Terraform Datadog Agentless Scanner module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/blob/main/README.md) creates a managed IAM policy with the scanning permissions and attaches it to your Datadog integration role. It also enables scanning for the account with the [`datadog_agentless_scanning_aws_scan_options`](https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/agentless_scanning_aws_scan_options) resource. The setup doesn't deploy any scanner infrastructure in your account.

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > AWS.
1. Open the AWS account you want to scan:
   - **Account already integrated with Datadog**: Click the account's row to open the side panel. Clicking the account ID opens the AWS integration page in a new tab instead.
   - **New AWS account**: At the bottom of the AWS section, click Add AWS accounts by following these steps and complete the [AWS integration](https://docs.datadoghq.com/integrations/amazon_web_services.md) setup. Then, click the new account's row to open the side panel.
1. On the Features tab, click Configure Agentless Scanning or Manage to open the Agentless Scanning Setup modal.
1. In the How would you like to set up Agentless scanning? section, select Terraform, then select Datadog-hosted (SaaS).
1. Under Apply the Terraform configuration, follow the instructions to apply the configuration. Provide the following variables:
   - `datadog_api_key` and `datadog_app_key`: Your Datadog API key and application key.
   - `datadog_site`: Your Datadog site (<YOUR_DATADOG_SITE>).
   - `datadog_integration_role`: The name of the IAM role that the Datadog AWS integration uses in this account.
1. Click Done.

To choose which features to enable, set the arguments of the `datadog_agentless_scanning_aws_scan_options` resource. For example, set `sensitive_data` to `false` to turn off Sensitive Data Scanner for Amazon S3 buckets.
{% /tab %}

After you attach the permissions, Datadog detects them automatically and begins scanning the account on the next scan cycle. Next, see the Verify your setup section.
{% /section %}

## Verify your setup{% #verify-your-setup %}

After completing the setup, Agentless Scanning takes time to produce initial results. The first scan cycle takes approximately 30 minutes to complete.

{% alert level="info" %}
If no results appear after two hours, see the [Agentless Scanning troubleshooting guide](https://docs.datadoghq.com/security/cloud_security_management/troubleshooting/agentless_scanning.md).
{% /alert %}

View scan results in the following locations:

- **For host, container, and serverless vulnerabilities**: [Cloud Security Vulnerabilities Explorer](https://app.datadoghq.com/security/csm/vm). To view only vulnerabilities detected by Agentless Scanning, use the filter `origin:"Agentless scanner"` in the search bar.
- **For sensitive data findings**: [Sensitive Data Scanner](https://app.datadoghq.com/sensitive-data-scanner/storage).

## Exclude resources from scans{% #exclude-resources-from-scans %}

To exclude specific hosts, containers, or functions from scans, see [Resource Evaluation Filters](https://docs.datadoghq.com/security/cloud_security_management/guide/resource_evaluation_filters.md).

## Disable Agentless Scanning{% #disable-agentless-scanning %}

{% section displayed-if="Scanner hosting is Self-hosted" %}
This section only applies to users who meet the following criteria: Scanner hosting is Self-hosted

{% section displayed-if="Cloud provider is AWS" %}
This section only applies to users who meet the following criteria: Cloud provider is AWS

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > AWS.
1. If required, use filters to find the account you want to stop Agentless Scanning for. Click the account to open the side panel that contains its settings.
1. On the Features tab, under Requires setup of the Agentless Scanners: switch the toggles to the off position.
{% /section %}

{% section displayed-if="Cloud provider is Azure" %}
This section only applies to users who meet the following criteria: Cloud provider is Azure

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > Azure.
1. Expand the tenant containing the subscription where you want to disable Agentless Scanning. Click the subscription to open the side panel that contains its settings.
1. On the Features tab, under Requires setup of the Agentless Scanners: switch the toggles to the off position.
{% /section %}

{% section displayed-if="Cloud provider is Google Cloud" %}
This section only applies to users who meet the following criteria: Cloud provider is Google Cloud

1. On the [Cloud Security Setup](https://app.datadoghq.com/security/configuration/csm/setup) page, click Cloud Integrations > GCP.
1. Expand the account containing the project where you want to disable Agentless Scanning. Click the project to open the side panel that contains its settings.
1. On the Features tab, under Requires setup of the Agentless Scanners: switch the toggles to the off position.
{% /section %}
{% /section %}

{% section displayed-if="Scanner hosting is Datadog-hosted (SaaS)" %}
This section only applies to users who meet the following criteria: Scanner hosting is Datadog-hosted (SaaS)

To stop scanning an AWS account, delete the CloudFormation stack that attached the Agentless Scanning permissions, or remove the permissions from your Terraform configuration.
{% /section %}

{% section displayed-if="Scanner hosting is Self-hosted" %}
This section only applies to users who meet the following criteria: Scanner hosting is Self-hosted

## Uninstall Agentless Scanning{% #uninstall-agentless-scanning %}

Select the deployment method you used to install Agentless Scanning:

{% section displayed-if="Cloud provider is AWS" %}
This section only applies to users who meet the following criteria: Cloud provider is AWS

{% tab title="AWS CloudFormation" %}
To uninstall Agentless Scanning, log in to your AWS console and delete the CloudFormation stack created for Agentless Scanning (the sub-stack name follows the pattern `DatadogIntegration-DatadogAgentlessScanning-...`).
{% /tab %}

{% tab title="Terraform" %}
To uninstall Agentless Scanning, remove the scanner module from your Terraform code. For more information, see the [Terraform module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/blob/main/README.md#uninstall) documentation.
{% /tab %}
{% /section %}

{% section displayed-if="Cloud provider is Azure" %}
This section only applies to users who meet the following criteria: Cloud provider is Azure

{% tab title="Azure Cloud Shell" %}
To uninstall Agentless Scanning that was set up using Azure Cloud Shell, run the same setup command you used during installation, replacing `deploy` with `destroy` at the end. For example:

```
curl -sSL "<CLOUD_SHELL_SCRIPT_URL>" -o azure_agentless_setup.pyz && \
DD_API_KEY="<DD_API_KEY>" \
DD_APP_KEY="<DD_APP_KEY>" \
DD_SITE="<DD_SITE>" \
SCANNER_SUBSCRIPTION="<SCANNER_SUBSCRIPTION>" \
python3 azure_agentless_setup.pyz destroy
```

The destroy command runs `terraform destroy`, deactivates Agentless scan options in Datadog for each previously configured subscription, and prompts before deleting the Key Vault that holds the API key. The resource group and Terraform state storage account are kept by default; the script prints manual deletion instructions for them.

You can review the [setup script source](https://github.com/DataDog/integrations-management/tree/main/azure/agentless) before running the command.
{% /tab %}

{% tab title="Azure Resource Manager" %}
To uninstall Agentless Scanning, log in to your Azure subscription. If you created a dedicated resource group for the Agentless scanner, delete this resource group along with the following Azure role definitions:

- Datadog Agentless Scanner Role
- Datadog Agentless Scanner Delegate Role

If you did not use a dedicated resource group, you must manually delete the scanner resources, which can be identified by the tags `Datadog:true` and `DatadogAgentlessScanner:true`.
{% /tab %}

{% tab title="Terraform" %}
To uninstall Agentless Scanning, remove the scanner module from your Terraform code. For more information, see the [Terraform module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/blob/main/README.md#uninstall) documentation.
{% /tab %}
{% /section %}

{% section displayed-if="Cloud provider is Google Cloud" %}
This section only applies to users who meet the following criteria: Cloud provider is Google Cloud

{% tab title="Google Cloud Shell" %}
To uninstall Agentless Scanning that was set up using Google Cloud Shell, run the same setup command you used during installation, replacing `deploy` with `destroy` at the end. For example:

```
curl -sSL "<CLOUD_SHELL_SCRIPT_URL>" -o gcp_agentless_setup.pyz && \
DD_API_KEY="<DD_API_KEY>" \
DD_APP_KEY="<DD_APP_KEY>" \
DD_SITE="<DD_SITE>" \
SCANNER_PROJECT="<SCANNER_PROJECT>" \
SCANNER_REGIONS="<SCANNER_REGIONS>" \
PROJECTS_TO_SCAN="<PROJECTS>" \
python3 gcp_agentless_setup.pyz destroy
```

You can review the [setup script source](https://github.com/DataDog/integrations-management/tree/main/gcp/agentless) before running the command.
{% /tab %}

{% tab title="Terraform" %}
To uninstall Agentless Scanning, remove the scanner module from your Terraform code. For more information, see the [Terraform module](https://github.com/DataDog/terraform-module-datadog-agentless-scanner/blob/main/README.md#uninstall) documentation.
{% /tab %}
{% /section %}
{% /section %}

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Setting up Cloud Security](https://docs.datadoghq.com/security/cloud_security_management/setup.md)
- [Cloud Security Agentless Scanning](https://docs.datadoghq.com/security/cloud_security_management/agentless_scanning.md)
- [Updating Agentless Scanning](https://docs.datadoghq.com/security/cloud_security_management/setup/agentless_scanning/update.md)
- [Troubleshooting Agentless Scanning](https://docs.datadoghq.com/security/cloud_security_management/troubleshooting/agentless_scanning.md)
