Disable and remove Defender for Containers
In brief
The documentation adds commands and procedures for disabling Defender for Containers and removing Defender components, extensions, Azure Policy integrations, and related AWS or GCP resources from AKS, EKS, GKE, and Arc-connected clusters. It also adds checks to confirm plans, extensions, and Defender pods are removed.
What Defender admins need to know
Administrators removing Defender for Containers can use the expanded procedures to complete cleanup and avoid leaving components behind or interrupting data collection by deleting runtime-protection resources prematurely.
Summaries are generated from the documentation change itself.
Documentation change
The comparison below shows only the changed extract. Use the full-page view for complete context.
Disable and remove Defender for Containers
This article explains how to disable Microsoft Defender for Containers and remove its components by environment.
Turning off the Defender for Containers plan or disabling automatic provisioning stops future deployments, but doesn't uninstall Defender components that are already deployed to clusters. ThoseDefender components already deployed to clusters are removed separately.
Disable Defender for Containers plan
To disable the Defender for Containers plan for the subscription that contains your AKS clusters:
Sign in to the Azure portal.
Go to Microsoft Defender for Cloud > Environment settings.
Remove Defender extensions from AKS clusters
After disabling the plan, remove the Defender-related components from each AKS cluster.
Remove the Defender for Containers profile from the AKS cluster
Run the following command to remove the Defender for Containers profile from the AKS cluster:
az aks update \
--name <cluster-name> \
### Disable Azure Policy add-on
If Azure Policy was enabled for this cluster, run the following command to disable the add-on:
```azurecli
az aks disable-addons \
--addons azure-policy \
## Verify removal
Use the following checks to confirm that Defender for Containers has been fully removed from your AKS cluster.
### Check AKS cluster pods
Run the following command to check all namespaces for remaining Defender pods and confirm that the uninstall completed successfully:
```bash
kubectl get pods -A | grep defender
Verify plan status
Run the following command to confirm that the Containers plan is disabled for the subscription:
az security pricing show --name 'Containers'
Remove the Defender extension
Run the following command to remove the Defender extension from the connected EKS cluster:
az k8s-extension delete \
--name microsoft.azuredefender.kubernetes \
### Remove the Azure Policy extension (if installed)
If the Azure Policy extension is installed on the EKS cluster, run the following command to remove it:
```azurecli
az k8s-extension delete \
--name azurepolicy \
## Disable Defender for Containers plan on the AWS connector
To disable the Defender for Containers plan on the AWS connector:
1. Sign in to the [Azure portal](https://portal.azure.com).
1. Go to **Microsoft Defender for Cloud** > **Environment settings**.
## Remove AWS resources created for runtime protection (optional)
Remove these resourcesthe S3 bucket, SQS queue, and Kinesis Data Firehose delivery stream only if runtime threat protection for EKS was enabled and you no longer use Defender for Containers for that cluster.
- [Delete the S3 bucket created for the cluster](https://docs.aws.amazon.com/AmazonS3/latest/userguide/delete-bucket.html).
- [Delete the Kinesis Data Firehose delivery stream created for the cluster](https://docs.aws.amazon.com/firehose/latest/APIReference/API_DeleteDeliveryStream.html).
Remove AWS IAM roles and identity providers (optional)
Check Azure Arc extensions
Run the following command to list the installed Arc extensions for your cluster and confirm that the Defender extension is no longer present:
az k8s-extension list \
--cluster-type connectedClusters \
### Check EKS cluster pods
Run the following command to verify that no Defender pods remain in the `mdc` namespace on your EKS cluster:
```bash
kubectl get pods -n mdc
Remove Defender extensions from GKE clusters
Use the following steps to remove Defender-related extensions from the GKE cluster.
Remove the Defender extension
Run the following command to delete the Microsoft Defender for Containers extension from your Arc-connected GKE cluster:
az k8s-extension delete \
--name microsoft.azuredefender.kubernetes \
### Remove the Azure Policy extension (if installed)
Azure Policy is installed as a separate Arc extension on the cluster. If it was deployed, delete it to fully remove Defender-related cluster integrations:
```azurecli
az k8s-extension delete \
--name azurepolicy \
## Disable Defender for Containers plan on the GCP connector
To disable the Defender for Containers plan for the GCP connector:
1. Sign in to the [Azure portal](https://portal.azure.com).
1. Go to **Microsoft Defender for Cloud** > **Environment settings**.
## Delete the GCP connector (optional)
If you no longer need the GCP connector, use the following steps to delete it:
1. Go to **Microsoft Defender for Cloud** > **Environment settings**.
1. Find your GCP connector.
## Remove GCP resources created for runtime protection (optional)
Remove the Pub/Sub topic and subscription and the Cloud Logging sink only if runtime threat protection for GKE was enabled and you no longer use Defender for Containers for that project.
- Delete the Pub/Sub topic and subscription that use the `MicrosoftDefender-` prefix.
* `MDCGkeClusterWriteRole`
Verify removal
Check Azure Arc extensions
Run the following command to confirm that the Defender extension is no longer installed on the GKE cluster:
az k8s-extension list \
--cluster-type connectedClusters \
### Check GKE cluster pods
Run the following command to verify that the `mdc` namespace no longer contains any Defender pods on your GKE cluster:
```bash
kubectl get pods -n mdc
Check Arc-enabled cluster pods
Run the following command to verify that no Defender pods remain in the mdc namespace on your Arc-enabled cluster:
kubectl get pods -n mdc
@@ -2,15 +2,16 @@ title: Disable and remove Defender for Containers description: Learn how to disable Microsoft Defender for Containers and remove its components for Kubernetes environments running on Azure, AWS, and Google Cloud. ms.topic: how-to-ms.date: 01/25/2026+ms.date: 07/03/2026 ai-usage: ai-assisted+ms.custom: msecd-doc-authoring-1013 --- # Disable and remove Defender for Containers This article explains how to disable Microsoft Defender for Containers and remove its components by environment. -Turning off the Defender for Containers plan or disabling automatic provisioning stops future deployments, but doesn't uninstall Defender components that are already deployed to clusters. Those components are removed separately.+Turning off the Defender for Containers plan or disabling automatic provisioning stops future deployments, but doesn't uninstall Defender components that are already deployed to clusters. Defender components already deployed to clusters are removed separately. > [!IMPORTANT] > Removing Defender for Containers stops protection for your clusters. Make sure you have alternative security measures in place before you proceed.@@ -34,6 +35,8 @@ After you remove Defender for Containers components from an AKS cluster: ## Disable Defender for Containers plan +To disable the Defender for Containers plan for the subscription that contains your AKS clusters:+ 1. Sign in to the [Azure portal](https://portal.azure.com). 1. Go to **Microsoft Defender for Cloud** > **Environment settings**.@@ -46,8 +49,12 @@ After you remove Defender for Containers components from an AKS cluster: ## Remove Defender extensions from AKS clusters +After disabling the plan, remove the Defender-related components from each AKS cluster.+ ### Remove the Defender for Containers profile from the AKS cluster +Run the following command to remove the Defender for Containers profile from the AKS cluster:+ ```azurecli az aks update \ --name <cluster-name> \@@ -57,6 +64,8 @@ az aks update \ ### Disable Azure Policy add-on +If Azure Policy was enabled for this cluster, run the following command to disable the add-on:+ ```azurecli az aks disable-addons \ --addons azure-policy \@@ -66,8 +75,12 @@ az aks disable-addons \ ## Verify removal +Use the following checks to confirm that Defender for Containers has been fully removed from your AKS cluster.+ ### Check AKS cluster pods +Run the following command to check all namespaces for remaining Defender pods and confirm that the uninstall completed successfully:+ ```bash kubectl get pods -A | grep defender ```@@ -76,6 +89,8 @@ No resources should be returned. ### Verify plan status +Run the following command to confirm that the Containers plan is disabled for the subscription:+ ```azurecli az security pricing show --name 'Containers' ```@@ -104,6 +119,8 @@ Defender for Containers deploys components to EKS clusters by using Azure Arc-en ### Remove the Defender extension +Run the following command to remove the Defender extension from the connected EKS cluster:+ ```azurecli az k8s-extension delete \ --name microsoft.azuredefender.kubernetes \@@ -115,6 +132,8 @@ az k8s-extension delete \ ### Remove the Azure Policy extension (if installed) +If the Azure Policy extension is installed on the EKS cluster, run the following command to remove it:+ ```azurecli az k8s-extension delete \ --name azurepolicy \@@ -138,6 +157,8 @@ az connectedk8s delete \ ## Disable Defender for Containers plan on the AWS connector +To disable the Defender for Containers plan on the AWS connector:+ 1. Sign in to the [Azure portal](https://portal.azure.com). 1. Go to **Microsoft Defender for Cloud** > **Environment settings**.@@ -168,7 +189,7 @@ If you no longer want Defender for Cloud to monitor your AWS account: ## Remove AWS resources created for runtime protection (optional) -Remove these resources only if runtime threat protection for EKS was enabled and you no longer use Defender for Containers for that cluster.+Remove the S3 bucket, SQS queue, and Kinesis Data Firehose delivery stream only if runtime threat protection for EKS was enabled and you no longer use Defender for Containers for that cluster. - [Delete the S3 bucket created for the cluster](https://docs.aws.amazon.com/AmazonS3/latest/userguide/delete-bucket.html). @@ -177,7 +198,7 @@ Remove these resources only if runtime threat protection for EKS was enabled and - [Delete the Kinesis Data Firehose delivery stream created for the cluster](https://docs.aws.amazon.com/firehose/latest/APIReference/API_DeleteDeliveryStream.html). > [!NOTE]-> These resources are created per cluster. If you remove them while runtime protection is still enabled, data collection can stop.+> The S3 bucket, SQS queue, and Kinesis Data Firehose delivery stream are created per cluster. If you remove them while runtime protection is still enabled, data collection can stop. ## Remove AWS IAM roles and identity providers (optional) @@ -198,6 +219,8 @@ Use the AWS console or CLI to delete the following roles if they exist: ### Check Azure Arc extensions +Run the following command to list the installed Arc extensions for your cluster and confirm that the Defender extension is no longer present:+ ```azurecli az k8s-extension list \ --cluster-type connectedClusters \@@ -209,6 +232,8 @@ Confirm that `microsoft.azuredefender.kubernetes` is not listed. ### Check EKS cluster pods +Run the following command to verify that no Defender pods remain in the `mdc` namespace on your EKS cluster:+ ```bash kubectl get pods -n mdc ```@@ -231,8 +256,12 @@ After you remove Defender for Containers components from a GKE cluster: ## Remove Defender extensions from GKE clusters +Use the following steps to remove Defender-related extensions from the GKE cluster.+ ### Remove the Defender extension +Run the following command to delete the Microsoft Defender for Containers extension from your Arc-connected GKE cluster:+ ```azurecli az k8s-extension delete \ --name microsoft.azuredefender.kubernetes \@@ -244,6 +273,8 @@ az k8s-extension delete \ ### Remove the Azure Policy extension (if installed) +Azure Policy is installed as a separate Arc extension on the cluster. If it was deployed, delete it to fully remove Defender-related cluster integrations:+ ```azurecli az k8s-extension delete \ --name azurepolicy \@@ -267,6 +298,8 @@ az connectedk8s delete \ ## Disable Defender for Containers plan on the GCP connector +To disable the Defender for Containers plan for the GCP connector:+ 1. Sign in to the [Azure portal](https://portal.azure.com). 1. Go to **Microsoft Defender for Cloud** > **Environment settings**.@@ -281,6 +314,8 @@ az connectedk8s delete \ ## Delete the GCP connector (optional) +If you no longer need the GCP connector, use the following steps to delete it:+ 1. Go to **Microsoft Defender for Cloud** > **Environment settings**. 1. Find your GCP connector.@@ -293,7 +328,7 @@ az connectedk8s delete \ ## Remove GCP resources created for runtime protection (optional) -Remove these resources only if runtime threat protection for GKE was enabled and you no longer use Defender for Containers for that project.+Remove the Pub/Sub topic and subscription and the Cloud Logging sink only if runtime threat protection for GKE was enabled and you no longer use Defender for Containers for that project. - Delete the Pub/Sub topic and subscription that use the `MicrosoftDefender-` prefix. @@ -315,12 +350,14 @@ Delete the following custom roles: * `MDCGkeClusterWriteRole` > [!WARNING]-> Only delete the `containers` and `containers-streams` OIDC workload identity pool providers if you are removing **all** Defender for Cloud components. These are shared components. Additionally, ensure no other non-Defender services are using the `logging.googleapis.com` API before disabling it.+> Only delete the `containers` and `containers-streams` OIDC workload identity pool providers if you are removing **all** Defender for Cloud components. The `containers` and `containers-streams` providers are shared components. Additionally, ensure no other non-Defender services are using the `logging.googleapis.com` API before disabling it. ## Verify removal ### Check Azure Arc extensions +Run the following command to confirm that the Defender extension is no longer installed on the GKE cluster:+ ```azurecli az k8s-extension list \ --cluster-type connectedClusters \@@ -332,6 +369,8 @@ Confirm that `microsoft.azuredefender.kubernetes` is not listed. ### Check GKE cluster pods +Run the following command to verify that the `mdc` namespace no longer contains any Defender pods on your GKE cluster:+ ```bash kubectl get pods -n mdc ```@@ -425,6 +464,8 @@ Confirm that `microsoft.azuredefender.kubernetes` is not listed. ### Check Arc-enabled cluster pods +Run the following command to verify that no Defender pods remain in the `mdc` namespace on your Arc-enabled cluster:+ ```bash kubectl get pods -n mdc ``` 