Defender For Storage - Create

Creates or updates the Defender for Storage settings on a specified storage account.

PUT https://management.azure.com/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/current?api-version=2022-12-01-preview

URI Parameters

Name In Required Type Description
resourceId
path True

string

The identifier of the resource.

settingName
path True

settingName

Defender for Storage setting name.

Regex pattern: ^[a-z][a-z0-9]*$

api-version
query True

string

API version for the operation

Request Body

Name Type Description
properties

DefenderForStorageSettingProperties

Defender for Storage resource properties.

Responses

Name Type Description
200 OK

DefenderForStorageSetting

Successful request to create or update Defender for Storage settings.

201 Created

DefenderForStorageSetting

Request to create or update Defender for Storage settings partially succeeded.

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Creates or updates the Defender for Storage settings on a specified resource.

Sample request

PUT https://management.azure.com/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current?api-version=2022-12-01-preview

{
  "properties": {
    "isEnabled": true,
    "malwareScanning": {
      "onUpload": {
        "isEnabled": true,
        "capGBPerMonth": -1
      },
      "scanResultsEventGridTopicResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic"
    },
    "sensitiveDataDiscovery": {
      "isEnabled": true
    },
    "overrideSubscriptionLevelSettings": true
  }
}

Sample response

{
  "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current",
  "type": "Microsoft.Security/defenderForStorageSettings",
  "name": "current",
  "properties": {
    "isEnabled": true,
    "malwareScanning": {
      "onUpload": {
        "isEnabled": true,
        "capGBPerMonth": -1
      },
      "scanResultsEventGridTopicResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic",
      "operationStatus": {
        "code": "Succeeded"
      }
    },
    "sensitiveDataDiscovery": {
      "isEnabled": true,
      "operationStatus": {
        "code": "Succeeded"
      }
    },
    "overrideSubscriptionLevelSettings": true
  }
}
{
  "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current",
  "type": "Microsoft.Security/defenderForStorageSettings",
  "name": "current",
  "properties": {
    "isEnabled": true,
    "malwareScanning": {
      "onUpload": {
        "isEnabled": false,
        "capGBPerMonth": -1
      },
      "operationStatus": {
        "code": "UnknownError",
        "message": "Failed to setup data scanner."
      }
    },
    "sensitiveDataDiscovery": {
      "isEnabled": false,
      "operationStatus": {
        "code": "UnknownError",
        "message": "Failed to setup data scanner."
      }
    },
    "overrideSubscriptionLevelSettings": true
  }
}

Definitions

Name Description
CloudError

Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

CloudErrorBody

The error detail.

DefenderForStorageSetting

The Defender for Storage resource.

DefenderForStorageSettingProperties

Defender for Storage resource properties.

ErrorAdditionalInfo

The resource management error additional info.

MalwareScanningProperties

Properties of Malware Scanning.

OnUploadProperties

Properties of On Upload malware scanning.

OperationStatus

A status describing the success/failure of the enablement/disablement operation.

SensitiveDataDiscoveryProperties

Properties of Sensitive Data Discovery.

settingName

Defender for Storage setting name.

CloudError

Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

Name Type Description
error.additionalInfo

ErrorAdditionalInfo[]

The error additional info.

error.code

string

The error code.

error.details

CloudErrorBody[]

The error details.

error.message

string

The error message.

error.target

string

The error target.

CloudErrorBody

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

CloudErrorBody[]

The error details.

message

string

The error message.

target

string

The error target.

DefenderForStorageSetting

The Defender for Storage resource.

Name Type Description
id

string

Resource Id

name

string

Resource name

properties

DefenderForStorageSettingProperties

Defender for Storage resource properties.

type

string

Resource type

DefenderForStorageSettingProperties

Defender for Storage resource properties.

Name Type Description
isEnabled

boolean

Indicates whether Defender for Storage is enabled on this storage account.

malwareScanning

MalwareScanningProperties

Properties of Malware Scanning.

overrideSubscriptionLevelSettings

boolean

Indicates whether the settings defined for this storage account should override the settings defined for the subscription.

sensitiveDataDiscovery

SensitiveDataDiscoveryProperties

Properties of Sensitive Data Discovery.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

MalwareScanningProperties

Properties of Malware Scanning.

Name Type Description
onUpload

OnUploadProperties

Properties of On Upload malware scanning.

operationStatus

OperationStatus

Upon failure or partial success. Additional data describing Malware Scanning enable/disable operation.

scanResultsEventGridTopicResourceId

string

Optional. Resource id of an Event Grid Topic to send scan results to.

OnUploadProperties

Properties of On Upload malware scanning.

Name Type Description
capGBPerMonth

integer

Defines the max GB to be scanned per Month. Set to -1 if no capping is needed.

isEnabled

boolean

Indicates whether On Upload malware scanning should be enabled.

OperationStatus

A status describing the success/failure of the enablement/disablement operation.

Name Type Description
code

string

The operation status code.

message

string

Additional information regarding the success/failure of the operation.

SensitiveDataDiscoveryProperties

Properties of Sensitive Data Discovery.

Name Type Description
isEnabled

boolean

Indicates whether Sensitive Data Discovery should be enabled.

operationStatus

OperationStatus

Upon failure or partial success. Additional data describing Sensitive Data Discovery enable/disable operation.

settingName

Defender for Storage setting name.

Name Type Description
current

string

Name of the Defender for Storage Settings name.