Blob Services - Set Service Properties

Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default?api-version=2023-01-01

URI Parameters

Name In Required Type Description
accountName
path True

string

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.

Regex pattern: ^[a-z0-9]+$

BlobServicesName
path True

BlobServicesName

The name of the blob Service within the specified storage account. Blob Service Name must be 'default'

resourceGroupName
path True

string

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

Regex pattern: ^[-\w\._\(\)]+$

subscriptionId
path True

string

The ID of the target subscription.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Type Description
properties.automaticSnapshotPolicyEnabled

boolean

Deprecated in favor of isVersioningEnabled property.

properties.changeFeed

ChangeFeed

The blob service properties for change feed events.

properties.containerDeleteRetentionPolicy

DeleteRetentionPolicy

The blob service properties for container soft delete.

properties.cors

CorsRules

Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service.

properties.defaultServiceVersion

string

DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions.

properties.deleteRetentionPolicy

DeleteRetentionPolicy

The blob service properties for blob soft delete.

properties.isVersioningEnabled

boolean

Versioning is enabled if set to true.

properties.lastAccessTimeTrackingPolicy

LastAccessTimeTrackingPolicy

The blob service property to configure last access time based tracking policy.

properties.restorePolicy

RestorePolicyProperties

The blob service properties for blob restore policy.

Responses

Name Type Description
200 OK

BlobServiceProperties

OK -- Sets The properties of a storage account’s Blob service 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

BlobServicesPutAllowPermanentDelete
BlobServicesPutLastAccessTimeBasedTracking
PutBlobServices

BlobServicesPutAllowPermanentDelete

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default?api-version=2023-01-01

{
  "properties": {
    "deleteRetentionPolicy": {
      "enabled": true,
      "days": 300,
      "allowPermanentDelete": true
    },
    "isVersioningEnabled": true
  }
}

Sample Response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default",
  "name": "default",
  "type": "Microsoft.Storage/storageAccounts/blobServices",
  "properties": {
    "deleteRetentionPolicy": {
      "enabled": true,
      "days": 300,
      "allowPermanentDelete": true
    },
    "isVersioningEnabled": true
  }
}

BlobServicesPutLastAccessTimeBasedTracking

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default?api-version=2023-01-01

{
  "properties": {
    "lastAccessTimeTrackingPolicy": {
      "enable": true,
      "name": "AccessTimeTracking",
      "trackingGranularityInDays": 1,
      "blobType": [
        "blockBlob"
      ]
    }
  }
}

Sample Response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default",
  "name": "default",
  "type": "Microsoft.Storage/storageAccounts/blobServices",
  "properties": {
    "lastAccessTimeTrackingPolicy": {
      "enable": true,
      "name": "AccessTimeTracking",
      "trackingGranularityInDays": 1,
      "blobType": [
        "blockBlob"
      ]
    }
  }
}

PutBlobServices

Sample Request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default?api-version=2023-01-01

{
  "properties": {
    "cors": {
      "corsRules": [
        {
          "allowedOrigins": [
            "http://www.contoso.com",
            "http://www.fabrikam.com"
          ],
          "allowedMethods": [
            "GET",
            "HEAD",
            "POST",
            "OPTIONS",
            "MERGE",
            "PUT"
          ],
          "maxAgeInSeconds": 100,
          "exposedHeaders": [
            "x-ms-meta-*"
          ],
          "allowedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x-ms-meta-target*"
          ]
        },
        {
          "allowedOrigins": [
            "*"
          ],
          "allowedMethods": [
            "GET"
          ],
          "maxAgeInSeconds": 2,
          "exposedHeaders": [
            "*"
          ],
          "allowedHeaders": [
            "*"
          ]
        },
        {
          "allowedOrigins": [
            "http://www.abc23.com",
            "https://www.fabrikam.com/*"
          ],
          "allowedMethods": [
            "GET",
            "PUT"
          ],
          "maxAgeInSeconds": 2000,
          "exposedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x -ms-meta-target*"
          ],
          "allowedHeaders": [
            "x-ms-meta-12345675754564*"
          ]
        }
      ]
    },
    "defaultServiceVersion": "2017-07-29",
    "deleteRetentionPolicy": {
      "enabled": true,
      "days": 300
    },
    "isVersioningEnabled": true,
    "changeFeed": {
      "enabled": true,
      "retentionInDays": 7
    }
  }
}

Sample Response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default",
  "name": "default",
  "type": "Microsoft.Storage/storageAccounts/blobServices",
  "properties": {
    "cors": {
      "corsRules": [
        {
          "allowedOrigins": [
            "http://www.contoso.com",
            "http://www.fabrikam.com"
          ],
          "allowedMethods": [
            "GET",
            "HEAD",
            "POST",
            "OPTIONS",
            "MERGE",
            "PUT"
          ],
          "maxAgeInSeconds": 100,
          "exposedHeaders": [
            "x-ms-meta-*"
          ],
          "allowedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x-ms-meta-target*"
          ]
        },
        {
          "allowedOrigins": [
            "*"
          ],
          "allowedMethods": [
            "GET"
          ],
          "maxAgeInSeconds": 2,
          "exposedHeaders": [
            "*"
          ],
          "allowedHeaders": [
            "*"
          ]
        },
        {
          "allowedOrigins": [
            "http://www.abc23.com",
            "https://www.fabrikam.com/*"
          ],
          "allowedMethods": [
            "GET",
            "PUT"
          ],
          "maxAgeInSeconds": 2000,
          "exposedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x -ms-meta-target*"
          ],
          "allowedHeaders": [
            "x-ms-meta-12345675754564*"
          ]
        }
      ]
    },
    "defaultServiceVersion": "2017-07-29",
    "deleteRetentionPolicy": {
      "enabled": true,
      "days": 300
    },
    "isVersioningEnabled": true,
    "changeFeed": {
      "enabled": true,
      "retentionInDays": 7
    }
  },
  "sku": {
    "name": "Standard_GRS",
    "tier": "Standard"
  }
}

Definitions

Name Description
AllowedMethods

Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

BlobServiceProperties

The properties of a storage account’s Blob service.

BlobServicesName

The name of the blob Service within the specified storage account. Blob Service Name must be 'default'

ChangeFeed

The blob service properties for change feed events.

CorsRule

Specifies a CORS rule for the Blob service.

CorsRules

Sets the CORS rules. You can include up to five CorsRule elements in the request.

DeleteRetentionPolicy

The service properties for soft delete.

LastAccessTimeTrackingPolicy

The blob service properties for Last access time based tracking policy.

name

Name of the policy. The valid value is AccessTimeTracking. This field is currently read only

RestorePolicyProperties

The blob service properties for blob restore policy

Sku

The SKU of the storage account.

SkuName

The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType.

SkuTier

The SKU tier. This is based on the SKU name.

AllowedMethods

Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

Name Type Description
CONNECT

string

DELETE

string

GET

string

HEAD

string

MERGE

string

OPTIONS

string

PATCH

string

POST

string

PUT

string

TRACE

string

BlobServiceProperties

The properties of a storage account’s Blob service.

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

boolean

Deprecated in favor of isVersioningEnabled property.

properties.changeFeed

ChangeFeed

The blob service properties for change feed events.

properties.containerDeleteRetentionPolicy

DeleteRetentionPolicy

The blob service properties for container soft delete.

properties.cors

CorsRules

Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service.

properties.defaultServiceVersion

string

DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions.

properties.deleteRetentionPolicy

DeleteRetentionPolicy

The blob service properties for blob soft delete.

properties.isVersioningEnabled

boolean

Versioning is enabled if set to true.

properties.lastAccessTimeTrackingPolicy

LastAccessTimeTrackingPolicy

The blob service property to configure last access time based tracking policy.

properties.restorePolicy

RestorePolicyProperties

The blob service properties for blob restore policy.

sku

Sku

Sku name and tier.

type

string

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

BlobServicesName

The name of the blob Service within the specified storage account. Blob Service Name must be 'default'

Name Type Description
default

string

ChangeFeed

The blob service properties for change feed events.

Name Type Description
enabled

boolean

Indicates whether change feed event logging is enabled for the Blob service.

retentionInDays

integer

Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed.

CorsRule

Specifies a CORS rule for the Blob service.

Name Type Description
allowedHeaders

string[]

Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request.

allowedMethods

AllowedMethods[]

Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

allowedOrigins

string[]

Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains

exposedHeaders

string[]

Required if CorsRule element is present. A list of response headers to expose to CORS clients.

maxAgeInSeconds

integer

Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response.

CorsRules

Sets the CORS rules. You can include up to five CorsRule elements in the request.

Name Type Description
corsRules

CorsRule[]

The List of CORS rules. You can include up to five CorsRule elements in the request.

DeleteRetentionPolicy

The service properties for soft delete.

Name Type Description
allowPermanentDelete

boolean

This property when set to true allows deletion of the soft deleted blob versions and snapshots. This property cannot be used blob restore policy. This property only applies to blob service and does not apply to containers or file share.

days

integer

Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365.

enabled

boolean

Indicates whether DeleteRetentionPolicy is enabled.

LastAccessTimeTrackingPolicy

The blob service properties for Last access time based tracking policy.

Name Type Description
blobType

string[]

An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only

enable

boolean

When set to true last access time based tracking is enabled.

name

name

Name of the policy. The valid value is AccessTimeTracking. This field is currently read only

trackingGranularityInDays

integer

The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1

name

Name of the policy. The valid value is AccessTimeTracking. This field is currently read only

Name Type Description
AccessTimeTracking

string

RestorePolicyProperties

The blob service properties for blob restore policy

Name Type Description
days

integer

how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days.

enabled

boolean

Blob restore is enabled if set to true.

lastEnabledTime

string

Deprecated in favor of minRestoreTime property.

minRestoreTime

string

Returns the minimum date and time that the restore can be started.

Sku

The SKU of the storage account.

Name Type Description
name

SkuName

The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType.

tier

SkuTier

The SKU tier. This is based on the SKU name.

SkuName

The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType.

Name Type Description
Premium_LRS

string

Premium_ZRS

string

Standard_GRS

string

Standard_GZRS

string

Standard_LRS

string

Standard_RAGRS

string

Standard_RAGZRS

string

Standard_ZRS

string

SkuTier

The SKU tier. This is based on the SKU name.

Name Type Description
Premium

string

Standard

string