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=2026-04-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
account
|
path | True |
string minLength: 3maxLength: 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. |
|
container
|
path | True |
string minLength: 3maxLength: 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. |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
The name of the resource group. The name is case insensitive. |
|
subscription
|
path | True |
string (uuid) |
The ID of the target subscription. The value must be an UUID. |
|
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: 3maxLength: 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 |
Azure operation completed successfully. |
|
| Other Status Codes |
An unexpected error response. |
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
|
Set |
|
Set |
SetLegalHoldContainers
Sample request
Sample response
{
"hasLegalHold": true,
"tags": [
"tag1",
"tag2",
"tag3"
]
}
SetLegalHoldContainersWithAllowProtectedAppendWritesAll
Sample request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res4303/providers/Microsoft.Storage/storageAccounts/sto7280/blobServices/default/containers/container8723/setLegalHold?api-version=2026-04-01
{
"allowProtectedAppendWritesAll": true,
"tags": [
"tag1",
"tag2",
"tag3"
]
}
Sample response
{
"allowProtectedAppendWritesAll": true,
"hasLegalHold": true,
"tags": [
"tag1",
"tag2",
"tag3"
]
}
Definitions
| Name | Description |
|---|---|
|
Error |
An error response from the storage resource provider. |
|
Error |
Error response body contract. |
|
Legal |
The LegalHold property of a blob container. |
ErrorResponse
An error response from the storage resource provider.
| Name | Type | Description |
|---|---|---|
| error |
Azure Storage Resource Provider error response body. |
ErrorResponseBody
Error response body contract.
| Name | Type | Description |
|---|---|---|
| code |
string |
An identifier for the error. Codes are invariant and are intended to be consumed programmatically. |
| message |
string |
A message describing the error, intended to be suitable for display in a user interface. |
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: 3maxLength: 23 |
Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. |