Share via


Blob Containers - Create

Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}?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 Type Description
properties.defaultEncryptionScope

string

Default the container to use specified encryption scope for all writes.

properties.denyEncryptionScopeOverride

boolean

Block override of encryption scope from the container default.

properties.enableNfsV3AllSquash

boolean

Enable NFSv3 all squash on blob container.

properties.enableNfsV3RootSquash

boolean

Enable NFSv3 root squash on blob container.

properties.immutableStorageWithVersioning

ImmutableStorageWithVersioning

The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process.

properties.metadata

object

A name-value pair to associate with the container as metadata.

properties.publicAccess

PublicAccess

Specifies whether data in the container may be accessed publicly and the level of access.

Responses

Name Type Description
200 OK

BlobContainer

OK -- The Container is already created.

201 Created

BlobContainer

Created -- Create Container operation 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

PutContainers
PutContainerWithDefaultEncryptionScope
PutContainerWithObjectLevelWorm

PutContainers

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185?api-version=2024-01-01

{}

Sample response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185",
  "name": "container6185",
  "type": "Microsoft.Storage/storageAccounts/blobServices/containers"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185",
  "name": "container6185",
  "type": "Microsoft.Storage/storageAccounts/blobServices/containers"
}

PutContainerWithDefaultEncryptionScope

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185?api-version=2024-01-01

{
  "properties": {
    "defaultEncryptionScope": "encryptionscope185",
    "denyEncryptionScopeOverride": true
  }
}

Sample response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185",
  "name": "container6185",
  "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
  "properties": {
    "defaultEncryptionScope": "encryptionscope185",
    "denyEncryptionScopeOverride": true
  }
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185",
  "name": "container6185",
  "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
  "properties": {
    "defaultEncryptionScope": "encryptionscope185",
    "denyEncryptionScopeOverride": true
  }
}

PutContainerWithObjectLevelWorm

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185?api-version=2024-01-01

{
  "properties": {
    "immutableStorageWithVersioning": {
      "enabled": true
    }
  }
}

Sample response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185",
  "name": "container6185",
  "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
  "properties": {
    "immutableStorageWithVersioning": {
      "enabled": true
    }
  }
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185",
  "name": "container6185",
  "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
  "properties": {
    "immutableStorageWithVersioning": {
      "enabled": true
    }
  }
}

Definitions

Name Description
BlobContainer

Properties of the blob container, including Id, resource name, resource type, Etag.

ImmutabilityPolicyProperties

The properties of an ImmutabilityPolicy of a blob container.

ImmutabilityPolicyState

The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked.

ImmutabilityPolicyUpdateType

The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend.

ImmutableStorageWithVersioning

Object level immutability properties of the container.

LeaseDuration

Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased.

LeaseState

Lease state of the container.

LeaseStatus

The lease status of the container.

LegalHoldProperties

The LegalHold property of a blob container.

MigrationState

This property denotes the container level immutability to object level immutability migration state.

ProtectedAppendWritesHistory

Protected append writes history setting for the blob container with Legal holds.

PublicAccess

Specifies whether data in the container may be accessed publicly and the level of access.

TagProperty

A tag of the LegalHold of a blob container.

UpdateHistoryProperty

An update history of the ImmutabilityPolicy of a blob container.

BlobContainer

Properties of the blob container, including Id, resource name, resource type, Etag.

Name Type Description
etag

string

Resource Etag.

id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties.defaultEncryptionScope

string

Default the container to use specified encryption scope for all writes.

properties.deleted

boolean

Indicates whether the blob container was deleted.

properties.deletedTime

string (date-time)

Blob container deletion time.

properties.denyEncryptionScopeOverride

boolean

Block override of encryption scope from the container default.

properties.enableNfsV3AllSquash

boolean

Enable NFSv3 all squash on blob container.

properties.enableNfsV3RootSquash

boolean

Enable NFSv3 root squash on blob container.

properties.hasImmutabilityPolicy

boolean

The hasImmutabilityPolicy public property is set to true by SRP if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container.

properties.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.

properties.immutabilityPolicy

ImmutabilityPolicyProperties

The ImmutabilityPolicy property of the container.

properties.immutableStorageWithVersioning

ImmutableStorageWithVersioning

The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process.

properties.lastModifiedTime

string (date-time)

Returns the date and time the container was last modified.

properties.leaseDuration

LeaseDuration

Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased.

properties.leaseState

LeaseState

Lease state of the container.

properties.leaseStatus

LeaseStatus

The lease status of the container.

properties.legalHold

LegalHoldProperties

The LegalHold property of the container.

properties.metadata

object

A name-value pair to associate with the container as metadata.

properties.publicAccess

PublicAccess

Specifies whether data in the container may be accessed publicly and the level of access.

properties.remainingRetentionDays

integer

Remaining retention days for soft deleted blob container.

properties.version

string

The version of the deleted blob container.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

ImmutabilityPolicyProperties

The properties of an ImmutabilityPolicy of a blob container.

Name Type Description
etag

string

ImmutabilityPolicy Etag.

properties.allowProtectedAppendWrites

boolean

This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API.

properties.allowProtectedAppendWritesAll

boolean

This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and 'allowProtectedAppendWritesAll' properties are mutually exclusive.

properties.immutabilityPeriodSinceCreationInDays

integer

The immutability period for the blobs in the container since the policy creation, in days.

properties.state

ImmutabilityPolicyState

The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked.

updateHistory

UpdateHistoryProperty[]

The ImmutabilityPolicy update history of the blob container.

ImmutabilityPolicyState

The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked.

Value Description
Locked
Unlocked

ImmutabilityPolicyUpdateType

The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend.

Value Description
extend
lock
put

ImmutableStorageWithVersioning

Object level immutability properties of the container.

Name Type Description
enabled

boolean

This is an immutable property, when set to true it enables object level immutability at the container level.

migrationState

MigrationState

This property denotes the container level immutability to object level immutability migration state.

timeStamp

string (date-time)

Returns the date and time the object level immutability was enabled.

LeaseDuration

Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased.

Value Description
Fixed
Infinite

LeaseState

Lease state of the container.

Value Description
Available
Breaking
Broken
Expired
Leased

LeaseStatus

The lease status of the container.

Value Description
Locked
Unlocked

LegalHoldProperties

The LegalHold property of a blob container.

Name Type Description
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.

protectedAppendWritesHistory

ProtectedAppendWritesHistory

Protected append blob writes history.

tags

TagProperty[]

The list of LegalHold tags of a blob container.

MigrationState

This property denotes the container level immutability to object level immutability migration state.

Value Description
Completed
InProgress

ProtectedAppendWritesHistory

Protected append writes history setting for the blob container with Legal holds.

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.

timestamp

string (date-time)

Returns the date and time the tag was added.

PublicAccess

Specifies whether data in the container may be accessed publicly and the level of access.

Value Description
Blob
Container
None

TagProperty

A tag of the LegalHold of a blob container.

Name Type Description
objectIdentifier

string

Returns the Object ID of the user who added the tag.

tag

string

The tag value.

tenantId

string

Returns the Tenant ID that issued the token for the user who added the tag.

timestamp

string (date-time)

Returns the date and time the tag was added.

upn

string

Returns the User Principal Name of the user who added the tag.

UpdateHistoryProperty

An update history of the ImmutabilityPolicy of a blob container.

Name Type Description
allowProtectedAppendWrites

boolean

This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API.

allowProtectedAppendWritesAll

boolean

This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and 'allowProtectedAppendWritesAll' properties are mutually exclusive.

immutabilityPeriodSinceCreationInDays

integer

The immutability period for the blobs in the container since the policy creation, in days.

objectIdentifier

string

Returns the Object ID of the user who updated the ImmutabilityPolicy.

tenantId

string

Returns the Tenant ID that issued the token for the user who updated the ImmutabilityPolicy.

timestamp

string (date-time)

Returns the date and time the ImmutabilityPolicy was updated.

update

ImmutabilityPolicyUpdateType

The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend.

upn

string

Returns the User Principal Name of the user who updated the ImmutabilityPolicy.