|
| 1 | +--- |
| 2 | +title: Microsoft Defender for Storage - excluding a storage account |
| 3 | +description: Excluding a specific storage account from a subscription with Microsoft Defender for Storage enabled. |
| 4 | +ms.date: 01/16/2022 |
| 5 | +ms.topic: how-to |
| 6 | +--- |
| 7 | +# Exclude a storage account from Microsoft Defender for Storage protections |
| 8 | + |
| 9 | +> [!CAUTION] |
| 10 | +> Excluding resources from advanced threat protection is not recommended and leaves your cloud workload exposed. |
| 11 | +
|
| 12 | +When you [enable Microsoft Defender for Storage](../storage/common/azure-defender-storage-configure.md#set-up-microsoft-defender-for-cloud) on a subscription, all existing Azure Storage accounts will be protected and any storage resources added to that subscription in the future will also be automatically protected. |
| 13 | + |
| 14 | +If you need to exempt a specific Azure Storage account from this Defender plan, use the instructions on this page. |
| 15 | + |
| 16 | +> [!TIP] |
| 17 | +> We recommend enabling [Microsoft Defender for Resource Manager](defender-for-resource-manager-introduction.md) for any accounts with unprotected Azure Storage resources. Defender for Resource Manager automatically monitors your organization's resource management operations, whether they're performed through the Azure portal, Azure REST APIs, Azure CLI, or other Azure programmatic clients. |
| 18 | +
|
| 19 | + |
| 20 | +## Exclude a specific storage account |
| 21 | + |
| 22 | +To exclude specific storage accounts from Microsoft Defender for Storage when the plan is enabled on a subscription: |
| 23 | + |
| 24 | +### [**PowerShell**](#tab/enable-storage-protection-ps) |
| 25 | + |
| 26 | +### Use PowerShell to exclude an Azure Storage account |
| 27 | + |
| 28 | +1. If you don't have the Azure Az PowerShell module installed, install it using [the instructions from the Azure PowerShell documentation](/powershell/azure/install-az-ps). |
| 29 | + |
| 30 | +1. Using an authenticated account, connect to Azure with the ``Connect-AzAccount`` cmdlet, as explained in [Sign in with Azure PowerShell](/powershell/azure/authenticate-azureps). |
| 31 | + |
| 32 | +1. Define the AzDefenderPlanAutoEnable tag on the storage account with the ``Update-AzTag`` cmdlet (replace the ResourceId with the resource ID of the relevant storage account): |
| 33 | + |
| 34 | + ```azurepowershell |
| 35 | + Update-AzTag -ResourceId <resourceID> -Tag @{"AzDefenderPlanAutoEnable" = "off"} -Operation Merge |
| 36 | + ``` |
| 37 | +
|
| 38 | + If you skip this stage, your untagged resources will continue receiving daily updates from the subscription level enablement policy. That policy will enable Defender for Storage again on the account. |
| 39 | +
|
| 40 | + > [!TIP] |
| 41 | + > Learn more about tags in [Use tags to organize your Azure resources and management hierarchy](/azure-resource-manager/management/tag-resources.md). |
| 42 | +
|
| 43 | +1. Disable Microsoft Defender for Storage for the desired account on the relevant subscription with the ``Disable-AzSecurityAdvancedThreatProtection`` cmdlet (using the same resource ID): |
| 44 | +
|
| 45 | + ```azurepowershell |
| 46 | + Disable-AzSecurityAdvancedThreatProtection -ResourceId <resourceId> |
| 47 | + ``` |
| 48 | +
|
| 49 | + [Learn more about this cmdlet](/powershell/module/az.security/disable-azsecurityadvancedthreatprotection). |
| 50 | +
|
| 51 | +
|
| 52 | +### [**Azure CLI**](#tab/enable-storage-protection-cli) |
| 53 | +
|
| 54 | +### Use Azure CLI to exclude an Azure Storage account |
| 55 | +
|
| 56 | +1. If you don't have Azure CLI installed, install it using [the instructions from the Azure CLI documentation](/cli/azure/install-azure-cli). |
| 57 | +
|
| 58 | +1. Using an authenticated account, connect to Azure with the ``login`` command as explained in [Sign in with Azure CLI](/cli/azure/authenticate-azure-cli) and enter your account credentials when prompted: |
| 59 | +
|
| 60 | + ```azurecli |
| 61 | + az login |
| 62 | + ``` |
| 63 | +
|
| 64 | +1. Define the AzDefenderPlanAutoEnable tag on the storage account with the ``tag update`` command (replace the ResourceId with the resource ID of the relevant storage account): |
| 65 | +
|
| 66 | + ```azurecli |
| 67 | + az tag update --resource-id MyResourceId --operation merge --tags AzDefenderPlanAutoEnable=off |
| 68 | + ``` |
| 69 | +
|
| 70 | + If you skip this stage, your untagged resources will continue receiving daily updates from the subscription level enablement policy. That policy will enable Defender for Storage again on the account. |
| 71 | +
|
| 72 | + > [!TIP] |
| 73 | + > Learn more about tags in [az tag](/cli/azure/tag). |
| 74 | +
|
| 75 | +1. Disable Microsoft Defender for Storage for the desired account on the relevant subscription with the ``security atp storage`` command (using the same resource ID): |
| 76 | +
|
| 77 | + ```azurecli |
| 78 | + az security atp storage update --resource-group MyResourceGroup --storage-account MyStorageAccount --is-enabled false |
| 79 | + ``` |
| 80 | +
|
| 81 | + [Learn more about this command](/cli/azure/security/atp/storage). |
| 82 | +
|
| 83 | +
|
| 84 | +### [**Azure portal**](#tab/enable-storage-protection-portal) |
| 85 | +
|
| 86 | +### Use the Azure portal to exclude an Azure Storage account |
| 87 | +
|
| 88 | +1. Define the AzDefenderPlanAutoEnable tag on the storage account: |
| 89 | +
|
| 90 | + 1. From the Azure portal, open the storage account and select the **Tags** page. |
| 91 | + 1. Enter the tag name **AzDefenderPlanAutoEnable** and set the value to **off**. |
| 92 | + 1. Select **Apply**. |
| 93 | +
|
| 94 | + :::image type="content" source="media/defender-for-storage-exclude/define-tag-storage-account.png" alt-text="Screenshot of how to add a tag to a storage account in the Azure portal." lightbox="media/defender-for-storage-exclude/define-tag-storage-account.png"::: |
| 95 | + |
| 96 | +1. Verify that the tag has been added successfully. It should look similar to this: |
| 97 | +
|
| 98 | + :::image type="content" source="media/defender-for-storage-exclude/define-tag-storage-account-success.png" alt-text="Screenshot of a tag on a storage account in the Azure portal." lightbox="media/defender-for-storage-exclude/define-tag-storage-account-success.png"::: |
| 99 | +
|
| 100 | +1. Disable and then enable the Microsoft Defender for Storage on the subscription: |
| 101 | +
|
| 102 | + 1. From the Azure portal, open **Microsoft Defender for Cloud**. |
| 103 | + 1. Open **Environment settings** > select the relevant subscription > **Defender plans** > toggle the Defender for Storage plan off > select **Save** > turn it back on > select **Save**. |
| 104 | +
|
| 105 | + :::image type="content" source="media/defender-for-storage-exclude/defender-plan-toggle.png" alt-text="Screenshot of disabling and enabling the Microsoft Defender for Storage plan from Microsoft Defender for Cloud." lightbox="media/defender-for-storage-exclude/defender-plan-toggle.png"::: |
| 106 | +
|
| 107 | +--- |
| 108 | +
|
| 109 | +
|
| 110 | +## Exclude an Azure Databricks Storage account |
| 111 | +
|
| 112 | +When Defender for Storage is enabled on a subscription, it's not currently possible to exclude a Storage account if it belongs to an Azure Databricks workspace. |
| 113 | +
|
| 114 | +Instead, you can disable Defender for Storage on the subscription and enable Defender for Storage for each Azure Storage account from the **Security** page: |
| 115 | +
|
| 116 | +:::image type="content" source="media/defender-for-storage-exclude/defender-plan-enable-resource.png" alt-text="Screenshot of enabling Microsoft Defender for Storage from the security page of an Azure Storage account." lightbox="media/defender-for-storage-exclude/defender-plan-enable-resource.png"::: |
| 117 | +
|
| 118 | +
|
| 119 | +## Next steps |
| 120 | +
|
| 121 | +- Explore the [Microsoft Defender for Storage – Price Estimation Dashboard](https://techcommunity.microsoft.com/t5/microsoft-defender-for-cloud/microsoft-defender-for-storage-price-estimation-dashboard/ba-p/2429724) |
0 commit comments