Uredi

Deli z drugimi prek


Configure Microsoft Defender for Containers components

Microsoft Defender for Containers is the cloud-native solution for securing your containers. It helps protect your clusters whether they're running in:

  • Azure Kubernetes Service (AKS): Microsoft's managed service for developing, deploying, and managing containerized applications.

  • Amazon Elastic Kubernetes Service (EKS) in a connected Amazon Web Services (AWS) account: Amazon's managed service for running Kubernetes on AWS without needing to install, operate, and maintain your own Kubernetes control plane or nodes.

  • Google Kubernetes Engine (GKE) in a connected Google Cloud Platform (GCP) project: Google's managed environment for deploying, managing, and scaling applications by using GCP infrastructure.

  • Other Kubernetes distributions (using Azure Arc-enabled Kubernetes): Cloud Native Computing Foundation (CNCF) certified Kubernetes clusters hosted on-premises or on infrastructure as a service (IaaS). For more information, see Containers support matrix in Defender for Cloud.

You can first learn how to connect and help protect your containers in these articles:

You can also learn more by watching these videos from the Defender for Cloud in the field video series:

Note

Defender for Containers support for Azure Arc-enabled Kubernetes clusters is a preview feature. The preview feature is available on a self-service, opt-in basis.

Previews are provided as is and as available. They're excluded from the service-level agreements and the limited warranty.

To learn more about the supported operating systems, feature availability, outbound proxy, and more, see Containers support matrix in Defender for Cloud.

Network requirements

Validate that the following endpoints are configured for outbound access so that the Defender sensor can connect to Microsoft Defender for Cloud to send security data and events.

The Defender sensor must connect to the configured Azure Monitor Log Analytics workspace. By default, AKS clusters have unrestricted outbound (egress) internet access. If event egress from the cluster requires the use of an Azure Monitor Private Link Scope (AMPLS), you must:

  • Define the cluster with Container insights and a Log Analytics workspace.
  • Configure the AMPLS with query access mode and ingestion access mode set to Open.
  • Define the cluster's Log Analytics workspace as a resource in the AMPLS.
  • Create in the AMPLS a virtual network private endpoint between the virtual network of the cluster and the Log Analytics resource. The virtual network private endpoint integrates with a private DNS zone.

For instructions, refer to Create an Azure Monitor Private Link Scope.

Network requirements

Validate that the following endpoints for public cloud deployments are configured for outbound access. Configuring them for outbound access helps ensure that the Defender sensor can connect to Microsoft Defender for Cloud to send security data and events.

Azure domain Azure Government domain Azure operated by 21Vianet domain Port
*.ods.opinsights.azure.com *.ods.opinsights.azure.us *.ods.opinsights.azure.cn 443
*.oms.opinsights.azure.com *.oms.opinsights.azure.us *.oms.opinsights.azure.cn 443
login.microsoftonline.com login.microsoftonline.us login.chinacloudapi.cn 443

You also need to validate the Azure Arc-enabled Kubernetes network requirements.

Enable the plan

  1. In Defender for Cloud, select Settings, and then select the relevant subscription.

  2. On the Defender plans page, select Containers > Settings.

    Screenshot of the page for Defender plans.

    Tip

    If the subscription already has Defender for Kubernetes or Defender for container registries enabled, an update notice appears. Otherwise, the only option is Containers.

    Screenshot that shows Defender for Kubernetes and Defender for container registries plans in a deprecated state, along with upgrade information.

  3. Turn on the relevant component.

    Screenshot that shows turning on components.

    Note

    • Defender for Containers customers who joined before August 2023 and don't have Agentless discovery for Kubernetes turned on as part of Defender cloud security posture management (CSPM) when they enabled the plan must manually enable the Agentless discovery for Kubernetes extension within the Defender for Containers plan.
    • When you turn off Defender for Containers, the components are set to Off. They're not deployed to any more containers, but they're not removed from containers where they're already installed.

Enablement method per capability

By default, when you enable the plan through the Azure portal, Microsoft Defender for Containers is configured to automatically enable all capabilities and install all required components to provide the protections that the plan offers. This configuration includes the assignment of a default workspace.

If you don't want to enable all capabilities of the plans, you can manually select which specific capabilities to enable by selecting Edit configuration for the Containers plan. Then, on the Settings & monitoring page, select the capabilities that you want to enable. You can also modify this configuration from the Defender plans page after initial configuration of the plan.

For detailed information on the enablement method for each capability, see the support matrix.

Roles and permissions

Learn more about the roles for provisioning Defender for Containers extensions.

Assigning a custom workspace for the Defender sensor

You can assign a custom workspace through Azure Policy.

Manual deployment of the Defender sensor or Azure policy agent without automatic provisioning by using recommendations

Capabilities that require sensor installation can also be deployed on one or more Kubernetes clusters. Use the appropriate recommendation:

Sensor Recommendation
Defender sensor for Kubernetes Azure Kubernetes Service clusters should have Defender profile enabled
Defender sensor for Azure Arc-enabled Kubernetes Azure Arc-enabled Kubernetes clusters should have the Defender extension installed
Azure Policy agent for Kubernetes Azure Kubernetes Service clusters should have the Azure Policy Add-on for Kubernetes installed
Azure Policy agent for Azure Arc-enabled Kubernetes Azure Arc-enabled Kubernetes clusters should have the Azure Policy extension installed

To deploy the Defender sensor on specific clusters:

  1. On the Microsoft Defender for Cloud Recommendations page, open the Enable enhanced security security control or search for one of the preceding recommendations. (You can also use the preceding links to open the recommendation directly.)

  2. View all clusters without a sensor by opening the Unhealthy tab.

  3. Select the clusters where you want to deploy the sensor, and then select Fix.

  4. Select Fix X resources.

Deploy the Defender sensor: All options

You can enable the Defender for Containers plan and deploy all of the relevant components by using the Azure portal, the REST API, or an Azure Resource Manager template. For detailed steps, select the relevant tab.

After the Defender sensor is deployed, a default workspace is automatically assigned. You can assign a custom workspace in place of the default workspace through Azure Policy.

Note

The Defender sensor is deployed to each node to provide the runtime protections and collect signals from those nodes by using eBPF technology.

Use the Fix button from the Defender for Cloud recommendation

You can use Azure portal pages to enable the Defender for Cloud plan and set up automatic provisioning of all the necessary components for defending your Kubernetes clusters at scale. The process is streamlined.

A dedicated Defender for Cloud recommendation provides:

  • Visibility into which of your clusters has the Defender sensor deployed.
  • A Fix button to deploy the sensor to clusters that don't have it.

To deploy the sensor:

  1. On the Microsoft Defender for Cloud Recommendations page, open the Enable enhanced security security control.

  2. Use the filter to find the recommendation named Azure Kubernetes Service clusters should have Defender profile enabled.

    Tip

    Notice the Fix icon in the Actions column.

  3. Select the clusters to see the details of the healthy and unhealthy resources (clusters with and without the sensor).

  4. In the list of unhealthy resources, select a cluster. Then select Remediate to open the pane with the remediation confirmation.

  5. Select Fix X resources.

Enable the plan

  1. In Defender for Cloud, select Settings, and then select the relevant subscription.

  2. On the Defender plans page, select Containers > Settings.

    Screenshot of the page for Defender plans.

    Tip

    If the subscription already has Defender for Kubernetes or Defender for container registries enabled, an update notice appears. Otherwise, the only option is Containers.

    Screenshot that shows Defender for Kubernetes and Defender for container registries plans in a deprecated state, along with upgrade information.

  3. Turn on the relevant component.

    Screenshot that shows turning on components.

    Note

    When you turn off Defender for Containers, the components are set to Off. They're not deployed to any more containers, but they're not removed from containers where they're already installed.

By default, when you enable the plan through the Azure portal, Microsoft Defender for Containers is configured to automatically install required components to provide the protections that the plan offers. This configuration includes the assignment of a default workspace.

If you want to disable automatic installation of components during the onboarding process, select Edit configuration for the Containers plan. The advanced options appear, and you can disable automatic installation for each component.

You can also modify this configuration from the Defender plans page.

Note

If you choose to disable the plan at any time after you enable it through the portal, you'll need to manually remove Defender for Containers components deployed on your clusters.

You can assign a custom workspace through Azure Policy.

If you disable the automatic installation of any component, you can easily deploy the component to one or more clusters by using the appropriate recommendation:

Learn more about the roles for provisioning Defender for Containers extensions.

Prerequisites

Before you deploy the sensor, ensure that you:

Deploy the Defender sensor

You can deploy the Defender sensor by using a range of methods. For detailed steps, select the relevant tab.

Use the Fix button from the Defender for Cloud recommendation

A dedicated Defender for Cloud recommendation provides:

  • Visibility into which of your clusters has the Defender sensor deployed.
  • A Fix button to deploy the sensor to clusters that don't have it.

To deploy the sensor:

  1. On the Microsoft Defender for Cloud Recommendations page, open the Enable enhanced security security control.

  2. Use the filter to find the recommendation named Azure Arc-enabled Kubernetes clusters should have Microsoft Defender's extension enabled.

    Screenshot that shows the Microsoft Defender for Cloud recommendation for deploying the Defender sensor for Azure Arc-enabled Kubernetes clusters.

    Tip

    Notice the Fix icon in the Actions column.

  3. Select the sensor to see the details of the healthy and unhealthy resources (clusters with and without the sensor).

  4. In the list of unhealthy resources, select a cluster. Then select Remediate to open the pane with the remediation options.

  5. Select the relevant Log Analytics workspace, and then select Remediate x resource.

    Animated screenshot that shows deploying a Defender sensor for Azure Arc by using remediation in Defender for Cloud.

Verify the deployment

To verify that your cluster has the Defender sensor installed on it, follow the steps on one of the following tabs.

Use Defender for Cloud recommendations to verify the status of your sensor

  1. On the Microsoft Defender for Cloud Recommendations page, open the Enable Microsoft Defender for Cloud security control.

  2. Select the recommendation named Azure Arc-enabled Kubernetes clusters should have Microsoft Defender's extension enabled.

    Screenshot that shows the Defender for Cloud recommendation for deploying the Defender sensor for Azure Arc-enabled Kubernetes clusters.

  3. Check that the cluster on which you deployed the sensor is listed as Healthy.

Enable the plan

Important

  • If you haven't connected an AWS account, connect your AWS account to Microsoft Defender for Cloud before you begin the following steps.
  • If you already enabled the plan on your connector, and you want to change optional configurations or enable new capabilities, go directly to step 4.

To help protect your EKS clusters, enable the Defender for Containers plan on the relevant account connector:

  1. In Defender for Cloud, open Environment settings.

  2. Select the AWS connector.

    Screenshot of an AWS connector in the Defender for Cloud environment settings.

  3. Verify that the toggle for the Containers plan is set to On.

    Screenshot of turning on Defender for Containers for an AWS connector.

  4. To change optional configurations for the plan, select Settings.

    Screenshot of the settings for the Containers plan in the Defender for Cloud environment settings.

    • Defender for Containers requires control plane audit logs to provide runtime threat protection. To send Kubernetes audit logs to Microsoft Defender, set the toggle for that feature to On. To change the retention period for your audit logs, enter the required time frame.

      Note

      If you disable this configuration, the Threat detection (control plane) feature is also disabled. Learn more about feature availability.

    • The Agentless discovery for Kubernetes feature provides API-based discovery of your Kubernetes clusters. To enable the feature, set its toggle to On.

    • The Agentless Container Vulnerability Assessment feature provides vulnerability management for images stored in ECR and for running images on your EKS clusters. To enable the feature, set its toggle to On.

  5. Continue through the remaining pages of the connector wizard.

  6. If you're enabling the Agentless Discovery for Kubernetes feature, you need to grant control plane permissions on the cluster. You can grant permissions in one of the following ways:

    • Run this Python script. The script adds the Defender for Cloud role MDCContainersAgentlessDiscoveryK8sRole to aws-auth ConfigMap for the EKS clusters that you want to onboard.

    • Grant each Amazon EKS cluster the MDCContainersAgentlessDiscoveryK8sRole role with the ability to interact with the cluster. Sign in to all existing and newly created clusters by using eksctl and run the following script:

          eksctl create iamidentitymapping \ 
          --cluster my-cluster \ 
          --region region-code \ 
          --arn arn:aws:iam::account:role/MDCContainersAgentlessDiscoveryK8sRole \ 
          --group system:masters\ 
          --no-duplicate-arns
      

      For more information, see Grant IAM users access to Kubernetes with EKS access entries in the Amazon EKS user guide.

  7. Azure Arc-enabled Kubernetes, the Defender sensor, and Azure Policy for Kubernetes should be installed and running on your EKS clusters. There's a dedicated Defender for Cloud recommendation to install these extensions (and Azure Arc, if necessary): EKS clusters should have Microsoft Defender's extension for Azure Arc installed.

    Use the following steps to install the required extensions:

    1. On the Defender for Cloud Recommendations page, search for and select the EKS clusters should have Microsoft Defender's extension for Azure Arc installed recommendation.

    2. Select an unhealthy cluster.

      Important

      You must select clusters one at a time.

      Don't select the clusters by their hyperlinked names. Select anywhere else in the relevant row.

    3. Select Fix.

    4. Defender for Cloud generates a script in the language of your choice: select Bash (for Linux) or PowerShell (for Windows).

    5. Select Download remediation logic.

    6. Run the generated script on your cluster.

    Animated screenshot of how to use the Defender for Cloud recommendation to generate a script for EKS clusters that enables the Azure Arc extension.

View recommendations and alerts for your EKS clusters

Tip

You can simulate container alerts by following the instructions in this blog post.

To view the alerts and recommendations for your EKS clusters, use the filters on the alerts, recommendations, and inventory pages to filter by resource type AWS EKS Cluster.

Screenshot of selections for using filters on the Microsoft Defender for Cloud security alerts page to view alerts related to AWS EKS clusters.

Deploy the Defender sensor

To deploy the Defender sensor on your AWS clusters:

  1. Go to Microsoft Defender for Cloud > Environment settings > Add environment > Amazon Web Services.

    Screenshot of selections for adding an AWS environment in Microsoft Defender for Cloud.

  2. Fill in the account details.

    Screenshot of the form to fill in the account details for an AWS environment in Microsoft Defender for Cloud.

  3. Go to Select plans, open the Containers plan, and make sure Auto provision Defender's sensor for Azure Arc is set to On.

    Screenshot of selections for enabling the Defender sensor for Azure Arc in Microsoft Defender for Cloud.

  4. Go to Configure access and follow the steps there.

    Screenshot of the page for configuring access for an AWS environment in Microsoft Defender for Cloud.

  5. After the Cloud Formation template is deployed successfully, select Create.

Note

You can exclude a specific AWS cluster from automatic provisioning. For sensor deployment, apply the ms_defender_container_exclude_agents tag on the resource with the value true. For agentless deployment, apply the ms_defender_container_exclude_agentless tag on the resource with the value true.

Enable the plan

Important

If you haven't connected a GCP project, connect your GCP project to Microsoft Defender for Cloud.

To help protect your GKE clusters, use the following steps to enable the Defender for Containers plan on the relevant GCP project.

Note

Verify that you don't have any Azure policies that prevent the Azure Arc installation.

  1. Sign in to the Azure portal.

  2. Go to Microsoft Defender for Cloud > Environment settings.

  3. Select the relevant GCP connector.

    Screenshot that shows an example GCP connector.

  4. Select the Next: Select plans > button.

  5. Ensure that the toggle for the Containers plan is On.

    Screenshot that shows the Containers plan turned on.

  6. To change optional configurations for the plan, select Settings.

    Screenshot of settings for the Containers plan in the Defender for Cloud environment settings.

    • Kubernetes audit logs to Defender for Cloud: Enabled by default. This configuration is available at the GCP project level only. It provides agentless collection of the audit log data through GCP Cloud Logging to the Microsoft Defender for Cloud back end for further analysis. Defender for Containers requires control plane audit logs to provide runtime threat protection. To send Kubernetes audit logs to Microsoft Defender, set the toggle to On.

      Note

      If you disable this configuration, the Threat detection (control plane) feature is also disabled. Learn more about feature availability.

    • Auto provision Defender's sensor for Azure Arc and Auto provision Azure Policy extension for Azure Arc: Enabled by default. You can install Azure Arc-enabled Kubernetes and its extensions on your GKE clusters in three ways:

    • The Agentless discovery for Kubernetes feature provides API-based discovery of your Kubernetes clusters. To enable the feature, set its toggle to On.

    • The Agentless Container Vulnerability Assessment feature provides vulnerability management for images stored in Google registries (Google Artifact Registry and Google Container Registry) and running images on your GKE clusters. To enable the feature, set its toggle to On.

  7. Select the Copy button.

    Screenshot that shows the location of the copy button.

  8. Select the GCP Cloud Shell > button.

  9. Paste the script into the Cloud Shell terminal and run it.

The connector is updated after the script runs. This process can take up to 8 hours to finish.

Deploy the solution to specific clusters

If you set any of the default automatic provisioning configurations to Off during the GCP connector onboarding process or afterward, you need to manually install Azure Arc-enabled Kubernetes, the Defender sensor, and Azure Policy for Kubernetes in each of your GKE clusters. Installing them helps ensure that you get the full security value out of Defender for Containers.

You can use two dedicated Defender for Cloud recommendations to install the extensions (and Azure Arc, if necessary):

  • GKE clusters should have Microsoft Defender's extension for Azure Arc installed
  • GKE clusters should have the Azure Policy extension installed

Note

When you're installing Arc extensions, you must verify that the provided GCP project is identical to the one in the relevant connector.

To deploy the solution to specific clusters:

  1. Sign in to the Azure portal.

  2. Go to Microsoft Defender for Cloud > Recommendations.

  3. On the Defender for Cloud Recommendations page, search for one of the recommendations by name.

    Screenshot that shows searching for a recommendation.

  4. Select an unhealthy GKE cluster.

    Important

    You must select clusters one at a time.

    Don't select the clusters by their hyperlinked names. Select anywhere else in the relevant row.

  5. Select the name of the unhealthy resource.

  6. Select Fix.

    Screenshot that shows the location of the Fix button.

  7. Defender for Cloud generates a script in the language of your choice:

    • For Linux, select Bash.
    • For Windows, select PowerShell.
  8. Select Download remediation logic.

  9. Run the generated script on your cluster.

  10. Repeat steps 3 through 8 for the other recommendation.

View your GKE cluster alerts

  1. Sign in to the Azure portal.

  2. Go to Microsoft Defender for Cloud > Security alerts.

  3. Select the button.

  4. On the Filter dropdown menu, select Resource type.

  5. On the Value dropdown menu, select GCP GKE Cluster.

  6. Select Ok.

Deploy the Defender sensor

To deploy the Defender sensor on your GCP clusters:

  1. Go to Microsoft Defender for Cloud > Environment settings > Add environment > Google Cloud Platform.

    Screenshot of selections for adding a GCP environment in Microsoft Defender for Cloud.

  2. Fill in the account details.

    Screenshot of the form to fill in the account details for a GCP environment in Microsoft Defender for Cloud.

  3. Go to Select plans, open the Containers plan, and make sure Auto provision Defender's sensor for Azure Arc is set to On.

    Screenshot of selections for enabling the Defender sensor for Azure Arc in Microsoft Defender for Cloud.

  4. Go to Configure access and follow the steps there.

    Screenshot of the page for configuring access for a GCP environment in Microsoft Defender for Cloud.

  5. After the gcloud script runs successfully, select Create.

Note

You can exclude a specific GCP cluster from automatic provisioning. For sensor deployment, apply the ms_defender_container_exclude_agents label on the resource with the value true. For agentless deployment, apply the ms_defender_container_exclude_agentless label on the resource with the value true.

Simulate security alerts from Microsoft Defender for Containers

A full list of supported alerts is available in the reference table of all Defender for Cloud security alerts.

To simulate a security alert:

  1. Run the following command from the cluster:

    kubectl get pods --namespace=asc-alerttest-662jfi039n
    

    The expected response is No resource found.

    Within 30 minutes, Defender for Cloud detects this activity and triggers a security alert.

    Note

    Azure Arc isn't a prerequisite for simulating agentless alerts for Defender for Containers.

  2. In the Azure portal, go to Microsoft Defender for Cloud > Security alerts and look for the alert on the relevant resource.

    Screenshot of a sample alert from Microsoft Defender for Kubernetes.

Remove the Defender sensor

To remove this (or any) Defender for Cloud extension, it's not enough to turn off automatic provisioning:

  • Enabling automatic provisioning potentially affects existing and future machines.
  • Disabling automatic provisioning for an extension affects only the future machines. Nothing is uninstalled when you disable automatic provisioning.

Note

To disable the Defender for Containers plan entirely, go to Environment settings and turn off Microsoft Defender for Containers.

Nevertheless, to ensure that the Defender for Containers components aren't automatically provisioned to your resources from now on, disable automatic provisioning of the extensions.

You can remove the extension from currently running machines by using the Azure portal, the Azure CLI, or the REST API, as explained on the following tabs.

Use the Azure portal to remove the extension

  1. In the Azure portal, open Azure Arc.

  2. In the infrastructure list, select Kubernetes clusters, and then select the specific cluster.

  3. Open the Extensions page, which lists extensions on the cluster.

  4. Select the extension, and then select Uninstall.

    Screenshot that shows the button for uninstalling an extension from an Azure Arc-enabled Kubernetes cluster.

Set a default Log Analytics workspace for AKS

The Defender sensor uses the Log Analytics workspace as a data pipeline to send data from the cluster to Defender for Cloud. The workspace doesn't retain any of the data. As a result, users aren't billed in this use case.

The Defender sensor uses a default Log Analytics workspace. If you don't have a default Log Analytics workspace, Defender for Cloud creates a new resource group and default workspace when you install the Defender sensor. The default workspace is based on your region.

The naming convention for the default Log Analytics workspace and resource group is:

  • Workspace: DefaultWorkspace-[subscription-ID]-[geo]
  • Resource group: DefaultResourceGroup-[geo]

Assign a custom workspace

When you enable automatic provisioning, a default workspace is automatically assigned. You can assign a custom workspace through Azure Policy.

To check if you have a workspace assigned:

  1. Sign in to the Azure portal.

  2. Search for and select Policy.

    Screenshot that shows how to locate the Policy page.

  3. Select Definitions.

  4. Search for policy ID 64def556-fbad-4622-930e-72d1d5589bf5.

    Screenshot that shows where to search for a policy by ID.

  5. Select Configure Azure Kubernetes Service clusters to enable Defender profile.

  6. Select Assignments.

    Screenshot that shows the Assignments tab.

  7. Use one of the next sections in this article as follows:

Create a new assignment with a custom workspace

If the policy isn't yet assigned, the Assignments tab shows the number 0.

Screenshot that shows that no workspace is assigned.

To assign a custom workspace:

  1. Select Assign.

  2. On the Parameters tab, clear the Only show parameters that need input or review option.

  3. Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.

    Screenshot that shows the dropdown menu for Log Analytics workspace resource ID.

  4. Select Review + create.

  5. Select Create.

Update an assignment with a custom workspace

If the policy is assigned to a workspace, the Assignments tab shows the number 1.

Screenshot of the tab that shows an assigned workspace.

Note

If you have more than one subscription, the number might be higher.

To assign a custom workspace:

  1. Select the relevant assignment.

    Screenshot that shows the selection of an assignment.

  2. Select Edit assignment.

  3. On the Parameters tab, clear the Only show parameters that need input or review option.

  4. Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.

    Screenshot that shows the dropdown menu for a Log Analytics workspace resource ID.

  5. Select Review + save.

  6. Select Save.

Default Log Analytics workspace for Azure Arc

The Defender sensor uses the Log Analytics workspace as a data pipeline to send data from the cluster to Defender for Cloud. The workspace doesn't retain any of the data. As a result, users aren't billed in this use case.

The Defender sensor uses a default Log Analytics workspace. If you don't have a default Log Analytics workspace, Defender for Cloud creates a new resource group and default workspace when you install the Defender sensor. The default workspace is based on your region.

The naming convention for the default Log Analytics workspace and resource group is:

  • Workspace: DefaultWorkspace-[subscription-ID]-[geo]
  • Resource group: DefaultResourceGroup-[geo]

Assign a custom workspace

When you enable automatic provisioning, a default workspace is automatically assigned. You can assign a custom workspace through Azure Policy.

To check if you have a workspace assigned:

  1. Sign in to the Azure portal.

  2. Search for and select Policy.

    Screenshot that shows how to locate the policy page for Azure Arc.

  3. Select Definitions.

  4. Search for policy ID 708b60a6-d253-4fe0-9114-4be4c00f012c.

    Screenshot that shows where to search for the policy by ID for Azure Arc.

  5. Select Configure Azure Arc enabled Kubernetes clusters to install Microsoft Defender for Cloud extension.

  6. Select Assignments.

    Screenshot that shows the Assignments tab for Azure Arc.

  7. Use one of the next sections in this article as follows:

Create a new assignment with a custom workspace

If the policy isn't yet assigned, the Assignments tab shows the number 0.

Screenshot that shows that no workspace is assigned for Azure Arc.

To assign a custom workspace:

  1. Select Assign.

  2. On the Parameters tab, clear the Only show parameters that need input or review option.

  3. Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.

    Screenshot that shows the dropdown menu for a Log Analytics workspace resource ID related to Azure Arc.

  4. Select Review + create.

  5. Select Create.

Update an assignment with a custom workspace

If the policy is assigned to a workspace, the Assignments tab shows the number 1.

Note

If you have more than one subscription, the number might be higher. If you have a number 1 or higher but the assignment isn't on the relevant scope, follow the Create a new assignment with a custom workspace steps.

Screenshot of the tab that shows an assigned workspace for Azure Arc.

To assign a custom workspace:

  1. Select the relevant assignment.

    Screenshot that shows the selection of an assignment for Azure Arc.

  2. Select Edit assignment.

  3. On the Parameters tab, clear the Only show parameters that need input or review option.

  4. Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.

    Screenshot that shows the dropdown menu for a Log Analytics workspace resource ID for Azure Arc.

  5. Select Review + save.

  6. Select Save.

Remove the Defender sensor

To remove this (or any) Defender for Cloud extension, it's not enough to turn off automatic provisioning:

  • Enabling automatic provisioning potentially affects existing and future machines.
  • Disabling automatic provisioning for an extension affects only the future machines. Nothing is uninstalled when you disable automatic provisioning.

Note

To disable the Defender for Containers plan entirely, go to Environment settings and turn off Microsoft Defender for Containers.

Nevertheless, to ensure that the Defender for Containers components aren't automatically provisioned to your resources from now on, disable automatic provisioning of the extensions.

You can remove the extension from currently running machines by using the REST API, the Azure CLI, or a Resource Manager template, as explained on the following tabs.

Use the REST API to remove the Defender sensor from AKS

To remove the extension by using the REST API, run the following PUT command:

https://management.azure.com/subscriptions/{{SubscriptionId}}/resourcegroups/{{ResourceGroup}}/providers/Microsoft.ContainerService/managedClusters/{{ClusterName}}?api-version={{ApiVersion}}

The command includes these parameters:

Name Description Mandatory
SubscriptionId Cluster's subscription ID Yes
ResourceGroup Cluster's resource group Yes
ClusterName Cluster's name Yes
ApiVersion API version; must be 2022-06-01 or later Yes

This is the request body:

{
  "location": "{{Location}}",
  "properties": {
    "securityProfile": {
            "defender": {
                "securityMonitoring": {
                    "enabled": false
                }
            }
        }
    }
}

The request body has these parameters:

Name Description Mandatory
location Cluster's location Yes
properties.securityProfile.defender.securityMonitoring.enabled Determines whether to enable or disable Microsoft Defender for Containers on the cluster Yes

Now that you've enabled Defender for Containers, you can:

To learn more about Defender for Cloud and Defender for Containers, check out the following blogs: