Share via


Blob Containers - Set Legal Hold

Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold?api-version=2024-01-01

URI Parameters

Name In Required Type Description
accountName
path True

string

minLength: 3
maxLength: 24
pattern: ^[a-z0-9]+$

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.

containerName
path True

string

minLength: 3
maxLength: 63

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.

resourceGroupName
path True

string

minLength: 1
maxLength: 90
pattern: ^[-\w\._\(\)]+$

The name of the resource group within the user's subscription. The name is case insensitive.

subscriptionId
path True

string

minLength: 1

The ID of the target subscription.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
tags True

string[]

minLength: 3
maxLength: 23

Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP.

allowProtectedAppendWritesAll

boolean

When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted.

Responses

Name Type Description
200 OK

LegalHold

OK -- Set legal hold tags for Container completed successfully.

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

SetLegalHoldContainers
SetLegalHoldContainersWithAllowProtectedAppendWritesAll

SetLegalHoldContainers

Sample request

POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4303/providers/Microsoft.Storage/storageAccounts/sto7280/blobServices/default/containers/container8723/setLegalHold?api-version=2024-01-01

{
  "tags": [
    "tag1",
    "tag2",
    "tag3"
  ]
}

Sample response

{
  "hasLegalHold": true,
  "tags": [
    "tag1",
    "tag2",
    "tag3"
  ]
}

SetLegalHoldContainersWithAllowProtectedAppendWritesAll

Sample request

POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4303/providers/Microsoft.Storage/storageAccounts/sto7280/blobServices/default/containers/container8723/setLegalHold?api-version=2024-01-01

{
  "tags": [
    "tag1",
    "tag2",
    "tag3"
  ],
  "allowProtectedAppendWritesAll": true
}

Sample response

{
  "hasLegalHold": true,
  "tags": [
    "tag1",
    "tag2",
    "tag3"
  ],
  "allowProtectedAppendWritesAll": true
}

Definitions

LegalHold

The LegalHold property of a blob container.

Name Type Description
allowProtectedAppendWritesAll

boolean

When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted.

hasLegalHold

boolean

The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold public property is set to false by SRP if all existing legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account.

tags

string[]

minLength: 3
maxLength: 23

Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP.