1. Packages
  2. Azure Classic
  3. API Docs
  4. securitycenter
  5. StorageDefender

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.securitycenter.StorageDefender

Explore with Pulumi AI

Manages the Defender for Storage.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "example-rg",
    location: "westus2",
});
const exampleAccount = new azure.storage.Account("example", {
    name: "exampleacc",
    resourceGroupName: example.name,
    location: example.location,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});
const exampleStorageDefender = new azure.securitycenter.StorageDefender("example", {storageAccountId: exampleAccount.id});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="example-rg",
    location="westus2")
example_account = azure.storage.Account("example",
    name="exampleacc",
    resource_group_name=example.name,
    location=example.location,
    account_tier="Standard",
    account_replication_type="LRS")
example_storage_defender = azure.securitycenter.StorageDefender("example", storage_account_id=example_account.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/securitycenter"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-rg"),
			Location: pulumi.String("westus2"),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
			Name:                   pulumi.String("exampleacc"),
			ResourceGroupName:      example.Name,
			Location:               example.Location,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("LRS"),
		})
		if err != nil {
			return err
		}
		_, err = securitycenter.NewStorageDefender(ctx, "example", &securitycenter.StorageDefenderArgs{
			StorageAccountId: exampleAccount.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-rg",
        Location = "westus2",
    });

    var exampleAccount = new Azure.Storage.Account("example", new()
    {
        Name = "exampleacc",
        ResourceGroupName = example.Name,
        Location = example.Location,
        AccountTier = "Standard",
        AccountReplicationType = "LRS",
    });

    var exampleStorageDefender = new Azure.SecurityCenter.StorageDefender("example", new()
    {
        StorageAccountId = exampleAccount.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.securitycenter.StorageDefender;
import com.pulumi.azure.securitycenter.StorageDefenderArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-rg")
            .location("westus2")
            .build());

        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
            .name("exampleacc")
            .resourceGroupName(example.name())
            .location(example.location())
            .accountTier("Standard")
            .accountReplicationType("LRS")
            .build());

        var exampleStorageDefender = new StorageDefender("exampleStorageDefender", StorageDefenderArgs.builder()
            .storageAccountId(exampleAccount.id())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-rg
      location: westus2
  exampleAccount:
    type: azure:storage:Account
    name: example
    properties:
      name: exampleacc
      resourceGroupName: ${example.name}
      location: ${example.location}
      accountTier: Standard
      accountReplicationType: LRS
  exampleStorageDefender:
    type: azure:securitycenter:StorageDefender
    name: example
    properties:
      storageAccountId: ${exampleAccount.id}
Copy

Create StorageDefender Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new StorageDefender(name: string, args: StorageDefenderArgs, opts?: CustomResourceOptions);
@overload
def StorageDefender(resource_name: str,
                    args: StorageDefenderArgs,
                    opts: Optional[ResourceOptions] = None)

@overload
def StorageDefender(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    storage_account_id: Optional[str] = None,
                    malware_scanning_on_upload_cap_gb_per_month: Optional[int] = None,
                    malware_scanning_on_upload_enabled: Optional[bool] = None,
                    override_subscription_settings_enabled: Optional[bool] = None,
                    scan_results_event_grid_topic_id: Optional[str] = None,
                    sensitive_data_discovery_enabled: Optional[bool] = None)
func NewStorageDefender(ctx *Context, name string, args StorageDefenderArgs, opts ...ResourceOption) (*StorageDefender, error)
public StorageDefender(string name, StorageDefenderArgs args, CustomResourceOptions? opts = null)
public StorageDefender(String name, StorageDefenderArgs args)
public StorageDefender(String name, StorageDefenderArgs args, CustomResourceOptions options)
type: azure:securitycenter:StorageDefender
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. StorageDefenderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. StorageDefenderArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. StorageDefenderArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. StorageDefenderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. StorageDefenderArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var storageDefenderResource = new Azure.SecurityCenter.StorageDefender("storageDefenderResource", new()
{
    StorageAccountId = "string",
    MalwareScanningOnUploadCapGbPerMonth = 0,
    MalwareScanningOnUploadEnabled = false,
    OverrideSubscriptionSettingsEnabled = false,
    ScanResultsEventGridTopicId = "string",
    SensitiveDataDiscoveryEnabled = false,
});
Copy
example, err := securitycenter.NewStorageDefender(ctx, "storageDefenderResource", &securitycenter.StorageDefenderArgs{
	StorageAccountId:                     pulumi.String("string"),
	MalwareScanningOnUploadCapGbPerMonth: pulumi.Int(0),
	MalwareScanningOnUploadEnabled:       pulumi.Bool(false),
	OverrideSubscriptionSettingsEnabled:  pulumi.Bool(false),
	ScanResultsEventGridTopicId:          pulumi.String("string"),
	SensitiveDataDiscoveryEnabled:        pulumi.Bool(false),
})
Copy
var storageDefenderResource = new StorageDefender("storageDefenderResource", StorageDefenderArgs.builder()
    .storageAccountId("string")
    .malwareScanningOnUploadCapGbPerMonth(0)
    .malwareScanningOnUploadEnabled(false)
    .overrideSubscriptionSettingsEnabled(false)
    .scanResultsEventGridTopicId("string")
    .sensitiveDataDiscoveryEnabled(false)
    .build());
Copy
storage_defender_resource = azure.securitycenter.StorageDefender("storageDefenderResource",
    storage_account_id="string",
    malware_scanning_on_upload_cap_gb_per_month=0,
    malware_scanning_on_upload_enabled=False,
    override_subscription_settings_enabled=False,
    scan_results_event_grid_topic_id="string",
    sensitive_data_discovery_enabled=False)
Copy
const storageDefenderResource = new azure.securitycenter.StorageDefender("storageDefenderResource", {
    storageAccountId: "string",
    malwareScanningOnUploadCapGbPerMonth: 0,
    malwareScanningOnUploadEnabled: false,
    overrideSubscriptionSettingsEnabled: false,
    scanResultsEventGridTopicId: "string",
    sensitiveDataDiscoveryEnabled: false,
});
Copy
type: azure:securitycenter:StorageDefender
properties:
    malwareScanningOnUploadCapGbPerMonth: 0
    malwareScanningOnUploadEnabled: false
    overrideSubscriptionSettingsEnabled: false
    scanResultsEventGridTopicId: string
    sensitiveDataDiscoveryEnabled: false
    storageAccountId: string
Copy

StorageDefender Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The StorageDefender resource accepts the following input properties:

StorageAccountId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
MalwareScanningOnUploadCapGbPerMonth int
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
MalwareScanningOnUploadEnabled bool
Whether On Upload malware scanning should be enabled. Defaults to false.
OverrideSubscriptionSettingsEnabled bool
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
ScanResultsEventGridTopicId string
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
SensitiveDataDiscoveryEnabled bool
Whether Sensitive Data Discovery should be enabled. Defaults to false.
StorageAccountId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
MalwareScanningOnUploadCapGbPerMonth int
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
MalwareScanningOnUploadEnabled bool
Whether On Upload malware scanning should be enabled. Defaults to false.
OverrideSubscriptionSettingsEnabled bool
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
ScanResultsEventGridTopicId string
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
SensitiveDataDiscoveryEnabled bool
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storageAccountId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malwareScanningOnUploadCapGbPerMonth Integer
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malwareScanningOnUploadEnabled Boolean
Whether On Upload malware scanning should be enabled. Defaults to false.
overrideSubscriptionSettingsEnabled Boolean
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scanResultsEventGridTopicId String
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitiveDataDiscoveryEnabled Boolean
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storageAccountId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malwareScanningOnUploadCapGbPerMonth number
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malwareScanningOnUploadEnabled boolean
Whether On Upload malware scanning should be enabled. Defaults to false.
overrideSubscriptionSettingsEnabled boolean
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scanResultsEventGridTopicId string
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitiveDataDiscoveryEnabled boolean
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storage_account_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malware_scanning_on_upload_cap_gb_per_month int
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malware_scanning_on_upload_enabled bool
Whether On Upload malware scanning should be enabled. Defaults to false.
override_subscription_settings_enabled bool
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scan_results_event_grid_topic_id str
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitive_data_discovery_enabled bool
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storageAccountId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malwareScanningOnUploadCapGbPerMonth Number
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malwareScanningOnUploadEnabled Boolean
Whether On Upload malware scanning should be enabled. Defaults to false.
overrideSubscriptionSettingsEnabled Boolean
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scanResultsEventGridTopicId String
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitiveDataDiscoveryEnabled Boolean
Whether Sensitive Data Discovery should be enabled. Defaults to false.

Outputs

All input properties are implicitly available as output properties. Additionally, the StorageDefender resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing StorageDefender Resource

Get an existing StorageDefender resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: StorageDefenderState, opts?: CustomResourceOptions): StorageDefender
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        malware_scanning_on_upload_cap_gb_per_month: Optional[int] = None,
        malware_scanning_on_upload_enabled: Optional[bool] = None,
        override_subscription_settings_enabled: Optional[bool] = None,
        scan_results_event_grid_topic_id: Optional[str] = None,
        sensitive_data_discovery_enabled: Optional[bool] = None,
        storage_account_id: Optional[str] = None) -> StorageDefender
func GetStorageDefender(ctx *Context, name string, id IDInput, state *StorageDefenderState, opts ...ResourceOption) (*StorageDefender, error)
public static StorageDefender Get(string name, Input<string> id, StorageDefenderState? state, CustomResourceOptions? opts = null)
public static StorageDefender get(String name, Output<String> id, StorageDefenderState state, CustomResourceOptions options)
resources:  _:    type: azure:securitycenter:StorageDefender    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
MalwareScanningOnUploadCapGbPerMonth int
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
MalwareScanningOnUploadEnabled bool
Whether On Upload malware scanning should be enabled. Defaults to false.
OverrideSubscriptionSettingsEnabled bool
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
ScanResultsEventGridTopicId string
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
SensitiveDataDiscoveryEnabled bool
Whether Sensitive Data Discovery should be enabled. Defaults to false.
StorageAccountId Changes to this property will trigger replacement. string
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
MalwareScanningOnUploadCapGbPerMonth int
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
MalwareScanningOnUploadEnabled bool
Whether On Upload malware scanning should be enabled. Defaults to false.
OverrideSubscriptionSettingsEnabled bool
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
ScanResultsEventGridTopicId string
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
SensitiveDataDiscoveryEnabled bool
Whether Sensitive Data Discovery should be enabled. Defaults to false.
StorageAccountId Changes to this property will trigger replacement. string
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malwareScanningOnUploadCapGbPerMonth Integer
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malwareScanningOnUploadEnabled Boolean
Whether On Upload malware scanning should be enabled. Defaults to false.
overrideSubscriptionSettingsEnabled Boolean
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scanResultsEventGridTopicId String
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitiveDataDiscoveryEnabled Boolean
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storageAccountId Changes to this property will trigger replacement. String
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malwareScanningOnUploadCapGbPerMonth number
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malwareScanningOnUploadEnabled boolean
Whether On Upload malware scanning should be enabled. Defaults to false.
overrideSubscriptionSettingsEnabled boolean
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scanResultsEventGridTopicId string
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitiveDataDiscoveryEnabled boolean
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storageAccountId Changes to this property will trigger replacement. string
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malware_scanning_on_upload_cap_gb_per_month int
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malware_scanning_on_upload_enabled bool
Whether On Upload malware scanning should be enabled. Defaults to false.
override_subscription_settings_enabled bool
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scan_results_event_grid_topic_id str
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitive_data_discovery_enabled bool
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storage_account_id Changes to this property will trigger replacement. str
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.
malwareScanningOnUploadCapGbPerMonth Number
The max GB to be scanned per Month. Must be -1 or above 0. Omit this property or set to -1 if no capping is needed. Defaults to -1.
malwareScanningOnUploadEnabled Boolean
Whether On Upload malware scanning should be enabled. Defaults to false.
overrideSubscriptionSettingsEnabled Boolean
Whether the settings defined for this storage account should override the settings defined for the subscription. Defaults to false.
scanResultsEventGridTopicId String
The Event Grid Topic where every scan result will be sent to. When you set an Event Grid custom topic, you must set override_subscription_settings_enabled to true to override the subscription-level settings.
sensitiveDataDiscoveryEnabled Boolean
Whether Sensitive Data Discovery should be enabled. Defaults to false.
storageAccountId Changes to this property will trigger replacement. String
The ID of the storage account the defender applied to. Changing this forces a new resource to be created.

Import

The setting can be imported using the resource id, e.g.

$ pulumi import azure:securitycenter/storageDefender:StorageDefender example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Storage/storageAccounts/storageacc
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.