Configure Microsoft Defender for Containers components
Članak
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:
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.
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.
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.
In Defender for Cloud, select Environment Settings, and then select the relevant subscription.
On the Defender plans page, toggle the Containers plan to On and then select its Settings link.
Turn on the relevant component.
Napomena
Defender for Containers customers who joined before August 2023 and don't have K8S API access turned on as part of Defender cloud security posture management (CSPM) when they enabled the plan must manually enable the K8S API access toggle 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 the Settings link 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.
To deploy the Defender sensor on specific clusters:
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.)
View all clusters without a sensor by opening the Unhealthy tab.
Select the clusters where you want to deploy the sensor, and then select Fix.
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.
Napomena
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:
On the Microsoft Defender for Cloud Recommendations page, open the Enable enhanced security security control.
Use the filter to find the recommendation named Azure Kubernetes Service clusters should have Defender profile enabled.
Savjet
Notice the Fix icon in the Actions column.
Select the clusters to see the details of the healthy and unhealthy resources (clusters with and without the sensor).
In the list of unhealthy resources, select a cluster. Then select Remediate to open the pane with the remediation confirmation.
Select Fix X resources.
Use the REST API to deploy the Defender sensor
To install securityProfile on an existing cluster by using the REST API, run the following PUT command:
rest
PUT https://management.azure.com/subscriptions/{{Subscription ID}}/resourcegroups/{{Resource Group}}/providers/Microsoft.Kubernetes/connectedClusters/{{Cluster Name}}/providers/Microsoft.KubernetesConfiguration/extensions/microsoft.azuredefender.kubernetes?api-version=2020-07-01-preview
az loginaz account set --subscription<your-subscription-id>
Važno
Ensure that you use the same subscription ID for <your-subscription-id> as the one that's associated with your AKS cluster.
Enable the Defender sensor on your containers:
Run the following command to create a new cluster with the Defender sensor enabled:
Azure CLI
az aks create --enable-defender--resource-group<your-resource-group>--name<your-cluster-name>
Run the following command to enable the Defender sensor on an existing cluster:
Azure CLI
az aks update --enable-defender--resource-group<your-resource-group>--name<your-cluster-name>
Here are the supported configuration settings on the Defender sensor type:
Property
Description
logAnalyticsWorkspaceResourceId
Optional. Full resource ID of your own Log Analytics workspace. If you don't provide one, the default workspace of the region is used.
To get the full resource ID, run the following command to display the list of workspaces in your subscriptions in the default JSON format: az resource list --resource-type Microsoft.OperationalInsights/workspaces -o json
The Log Analytics workspace's resource ID has the following syntax: /subscriptions/{your-subscription-id}/resourceGroups/{your-resource-group}/providers/Microsoft.OperationalInsights/workspaces/{your-workspace-name} Learn more in Log Analytics workspaces.
You can include these settings in a JSON file and specify the JSON file in the az aks create and az aks update commands with this parameter: --defender-config <path-to-JSON-file>. The format of the JSON file must be:
To verify that the sensor was successfully added, run the following command on your machine with the kubeconfig file pointed to your cluster:
Console
kubectl get pods -n kube-system
When the sensor is added, you should see a pod called microsoft-defender-XXXXX in the Running state. It might take a few minutes for pods to be added.
Use Azure Resource Manager to deploy the Defender sensor
To use Azure Resource Manager to deploy the Defender sensor, you need a Log Analytics workspace on your subscription. Learn more in Log Analytics workspaces.
In Defender for Cloud, select Settings, and then select the relevant subscription.
On the Defender plans page, select Containers > Settings.
Turn on the relevant component.
Napomena
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.
Napomena
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.
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:
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:
On the Microsoft Defender for Cloud Recommendations page, open the Enable enhanced security security control.
Use the filter to find the recommendation named Azure Arc-enabled Kubernetes clusters should have Microsoft Defender's extension enabled.
Savjet
Notice the Fix icon in the Actions column.
Select the sensor to see the details of the healthy and unhealthy resources (clusters with and without the sensor).
In the list of unhealthy resources, select a cluster. Then select Remediate to open the pane with the remediation options.
Select the relevant Log Analytics workspace, and then select Remediate x resource.
Use the Azure CLI to deploy the Defender sensor
Sign in to Azure:
Azure CLI
az loginaz account set --subscription<your-subscription-id>
Važno
Ensure that you use the same subscription ID for <your-subscription-id> as the one that you used when connecting your cluster to Azure Arc.
Run the following command to deploy the sensor on top of your Azure Arc-enabled Kubernetes cluster:
Azure CLI
az k8s-extension create --name microsoft.azuredefender.kubernetes --cluster-type connectedClusters --cluster-name<cluster-name>--resource-group<resource-group>--extension-type microsoft.azuredefender.kubernetes
Here are the supported configuration settings on the Defender sensor type:
Property
Description
logAnalyticsWorkspaceResourceID
Optional. Full resource ID of your own Log Analytics workspace. If you don't provide one, the default workspace of the region is used.
To get the full resource ID, run the following command to display the list of workspaces in your subscriptions in the default JSON format: az resource list --resource-type Microsoft.OperationalInsights/workspaces -o json
The Log Analytics workspace resource ID has the following syntax: /subscriptions/{your-subscription-id}/resourceGroups/{your-resource-group}/providers/Microsoft.OperationalInsights/workspaces/{your-workspace-name} Learn more in Log Analytics workspaces.
auditLogPath
Optional. Full path to the audit log files. If you don't provide one, the default path /var/log/kube-apiserver/audit.log is used. For AKS Engine, the standard path is /var/log/kubeaudit/audit.log.
The following command shows an example usage of all optional fields:
Use Azure Resource Manager to deploy the Defender sensor
To use Azure Resource Manager to deploy the Defender sensor, you need a Log Analytics workspace on your subscription. Learn more in Log Analytics workspaces.
You can use the azure-defender-extension-arm-template.json Resource Manager template from the Defender for Cloud installation examples.
To use the REST API to deploy the Defender sensor, you need a Log Analytics workspace on your subscription. Learn more in Log Analytics workspaces.
To manually deploy the sensor by using the REST API, run the following PUT command:
rest
PUT https://management.azure.com/subscriptions/{{Subscription ID}}/resourcegroups/{{Resource Group}}/providers/Microsoft.Kubernetes/connectedClusters/{{Cluster Name}}/providers/Microsoft.KubernetesConfiguration/extensions/microsoft.azuredefender.kubernetes?api-version=2020-07-01-preview
The command includes these parameters:
Name
In
Required
Type
Description
Subscription ID
Path
True
String
Your Azure Arc-enabled Kubernetes resource's subscription ID
Resource Group
Path
True
String
Name of the resource group that contains your Azure Arc-enabled Kubernetes resource
Cluster Name
Path
True
String
Name of your Azure Arc-enabled Kubernetes resource
For Authentication, your header must have a bearer token (as with other Azure APIs). To get a bearer token, run the following command:
az account get-access-token --subscription <your-subscription-id>
Use the following structure for the body of your message:
Use Defender for Cloud recommendations to verify the status of your sensor
On the Microsoft Defender for Cloud Recommendations page, open the Enable Microsoft Defender for Cloud security control.
Select the recommendation named Azure Arc-enabled Kubernetes clusters should have Microsoft Defender's extension enabled.
Check that the cluster on which you deployed the sensor is listed as Healthy.
Use the Azure Arc pages to verify the status of your sensor
In the Azure portal, open Azure Arc.
In the infrastructure list, select Kubernetes clusters, and then select the specific cluster.
Open the Extensions page. The page lists the extensions on the cluster. To confirm whether the Defender sensor was installed correctly, check the Install status column.
For more details, select the extension.
Use the Azure CLI to verify that the sensor is deployed
Run the following command in the Azure CLI:
Azure CLI
az k8s-extension show --cluster-type connectedClusters --cluster-name<your-connected-cluster-name>--resource-group<your-rg>--name microsoft.azuredefender.kubernetes
In the response, look for "extensionType": "microsoft.azuredefender.kubernetes" and "installState": "Installed".
Napomena
The response might show "installState": "Pending" for the first few minutes.
If the state shows Installed, run the following command on your machine with the kubeconfig file pointed to your cluster. Then check that all pods under the mdc namespace are in the Running state.
Console
kubectl get pods -n mdc
Use the REST API to verify that the sensor is deployed
To confirm a successful deployment, or to validate the status of your sensor at any time:
Run the following GET command:
rest
GET https://management.azure.com/subscriptions/{{Subscription ID}}/resourcegroups/{{Resource Group}}/providers/Microsoft.Kubernetes/connectedClusters/{{Cluster Name}}/providers/Microsoft.KubernetesConfiguration/extensions/microsoft.azuredefender.kubernetes?api-version=2020-07-01-preview
In the response, look in "extensionType": "microsoft.azuredefender.kubernetes" for "installState": "Installed".
Savjet
The response might show "installState": "Pending" for the first few minutes.
If the state shows Installed, run the following command on your machine with the kubeconfig file pointed to your cluster. Then check that all pods under the mdc namespace are in the Running state.
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:
In Defender for Cloud, open Environment settings.
Select the AWS connector.
Select the Defender plans page and verify that the toggle for the Containers plan is set to On.
To change optional configurations for the plan, select Settings.
The Agentless threat protection feature provides runtime protection to your cluster containers. The feature sends Kubernetes audit logs to Microsoft Defender. Set the Agentless threat protection toggle to On and set the retention period of your audit logs.
Napomena
If you disable this configuration, control plane threat detection is disabled. Learn more about feature availability.
K8S API access sets permissions to allow API-based discovery of your Kubernetes clusters. To enable, set the K8S API access toggle to On.
Registry access sets permissions to allow vulnerability assessment of images stored in ECR. To enable, set the Registry access toggle to On.
Continue through the remaining pages of the connector wizard.
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:
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.
Follow the remediation steps provided by the recommendation:
View recommendations and alerts for your EKS clusters
Savjet
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.
Deploy the Defender sensor
To deploy the Defender sensor on your AWS clusters:
Go to Microsoft Defender for Cloud > Environment settings > Add environment > Amazon Web Services.
Fill in the account details.
Go to Select plans, open the Containers plan, and make sure Auto provision Defender's sensor for Azure Arc is set to On.
Go to Configure access and follow the steps there.
After the Cloud Formation template is deployed successfully, select Create.
Napomena
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.
Go to Microsoft Defender for Cloud > Environment settings.
Select the relevant GCP connector.
Select the Next: Select plans > button.
Ensure that the toggle for the Containers plan is On.
To change optional configurations for the plan, select Settings.
Agentless threat detection: 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.
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:
Enable Defender for Containers automatic provisioning at the project level, as explained in the instructions in this section. We recommend this method.
The K8S API access feature provides API-based discovery of your Kubernetes clusters. Set the K8S API access toggle to On.
The Registry access feature provides vulnerability management for images stored in Google registries (Google Artifact Registry and Google Container Registry) and running images on your GKE clusters. Set the Registry access toggle to On.
Select the Copy button.
Select the GCP Cloud Shell > button.
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
Napomena
When you're installing Arc extensions, you must verify that the provided GCP project is identical to the one in the relevant connector.
Go to Microsoft Defender for Cloud > Security alerts.
Select the
button.
On the Filter dropdown menu, select Resource type.
On the Value dropdown menu, select GCP GKE Cluster.
Select Ok.
Deploy the Defender sensor
To deploy the Defender sensor on your GCP clusters:
Go to Microsoft Defender for Cloud > Environment settings > Add environment > Google Cloud Platform.
Fill in the account details.
Go to Select plans, open the Containers plan, and make sure Auto provision Defender's sensor for Azure Arc is set to On.
Go to Configure access and follow the steps there.
After the gcloud script runs successfully, select Create.
Napomena
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
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.
Napomena
Azure Arc isn't a prerequisite for simulating agentless alerts for Defender for Containers.
In the Azure portal, go to Microsoft Defender for Cloud > Security alerts and look for the alert on the relevant resource.
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.
Napomena
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.
In the infrastructure list, select Kubernetes clusters, and then select the specific cluster.
Open the Extensions page, which lists extensions on the cluster.
Select the extension, and then select Uninstall.
Use the Azure CLI to remove the Defender sensor
Remove the Azure Arc extension for Microsoft Defender for Kubernetes by using the following commands:
Azure CLI
az loginaz account set --subscription<subscription-id>az k8s-extension delete --cluster-type connectedClusters --cluster-name<your-connected-cluster-name>--resource-group<your-rg>--name microsoft.azuredefender.kubernetes --yes
Removing the extension might take a few minutes. We recommend that you wait before you try to verify that it was successful.
To verify that you successfully removed the extension, run the following commands:
Azure CLI
az k8s-extension show --cluster-type connectedClusters --cluster-name<your-connected-cluster-name>--resource-group<your-rg>--name microsoft.azuredefender.kubernetes
Validate that there are no pods under the mdc namespace on the cluster. Run the following command with the kubeconfig file pointed to your cluster:
Console
kubectl get pods -n mdc
Deletion of the pods might take a few minutes.
Use the REST API to remove the Defender sensor
To remove the extension by using the REST API, run the following DELETE command:
Your Azure Arc-enabled Kubernetes cluster's subscription ID
Resource Group
Path
True
String
Your Azure Arc-enabled Kubernetes cluster's resource group
Cluster Name
Path
True
String
Your Azure Arc-enabled Kubernetes cluster's name
For Authentication, your header must have a bearer token (as with other Azure APIs). To get a bearer token, run the following command:
Azure CLI
az account get-access-token --subscription<your-subscription-id>
The request might take several minutes to complete.
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:
If the policy isn't yet assigned, the Assignments tab shows the number 0.
To assign a custom workspace:
Select Assign.
On the Parameters tab, clear the Only show parameters that need input or review option.
Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.
Select Review + create.
Select Create.
Update an assignment with a custom workspace
If the policy is assigned to a workspace, the Assignments tab shows the number 1.
Napomena
If you have more than one subscription, the number might be higher.
To assign a custom workspace:
Select the relevant assignment.
Select Edit assignment.
On the Parameters tab, clear the Only show parameters that need input or review option.
Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.
Select Review + save.
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:
If the policy isn't yet assigned, the Assignments tab shows the number 0.
To assign a custom workspace:
Select Assign.
On the Parameters tab, clear the Only show parameters that need input or review option.
Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.
Select Review + create.
Select Create.
Update an assignment with a custom workspace
If the policy is assigned to a workspace, the Assignments tab shows the number 1.
Napomena
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.
To assign a custom workspace:
Select the relevant assignment.
Select Edit assignment.
On the Parameters tab, clear the Only show parameters that need input or review option.
Select a LogAnalyticsWorkspaceResourceId value from the dropdown menu.
Select Review + save.
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.
Napomena
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.
Determines whether to enable or disable Microsoft Defender for Containers on the cluster
Yes
Use the Azure CLI to remove the Defender sensor
Run the following commands:
Azure CLI
az loginaz account set --subscription<subscription-id>az aks update --disable-defender--resource-group<your-resource-group>--name<your-cluster-name>
Removing the extension might take a few minutes.
To verify that you successfully removed the extension, run the following command:
Console
kubectl get pods -n kube-system | grep microsoft-defender
When the extension is removed, the get pods command doesn't return any pods. Deletion of the pods might take a few minutes.
Use Azure Resource Manager to remove the Defender sensor from AKS
To use Azure Resource Manager to remove the Defender sensor, you need a Log Analytics workspace on your subscription. Learn more in Log Analytics workspaces.
Use Azure Policy to enforce policies and safeguards on your Kubernetes clusters at scale. Azure Policy Ensures that your cluster is secure, compliant, and consistent across your organization.
Learn about the benefits and features of Microsoft Defender for Kubernetes and how it provides real-time threat protection for your Azure Kubernetes Service (AKS) containerized environments.