Blob Services - Set Service Properties

設定記憶體帳戶 Blob 服務的屬性,包括 儲存體分析 和 CORS (跨原始來源資源分享) 規則的屬性。

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

URI 參數

名稱 位於 必要 類型 Description
accountName
path True

string

指定資源群組內的記憶體帳戶名稱。 儲存體帳戶名稱必須介於 3 到 24 個字元的長度,而且只能使用數字和小寫字母。

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

BlobServicesName
path True

BlobServicesName

指定之記憶體帳戶內的 Blob 服務名稱。 Blob 服務名稱必須是 'default'

resourceGroupName
path True

string

用戶訂用帳戶內的資源組名。 名稱不區分大小寫。

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

subscriptionId
path True

string

目標訂用帳戶的標識碼。

api-version
query True

string

用於此作業的 API 版本。

要求本文

名稱 類型 Description
properties.automaticSnapshotPolicyEnabled

boolean

已取代為isVersioningEnabled屬性。

properties.changeFeed

ChangeFeed

變更摘要事件的 Blob 服務屬性。

properties.containerDeleteRetentionPolicy

DeleteRetentionPolicy

容器虛刪除的 Blob 服務屬性。

properties.cors

CorsRules

指定 Blob 服務的 CORS 規則。 您可以在要求中包含最多五個 CorsRule 元素。 如果要求本文中未包含 CorsRule 元素,則會刪除所有 CORS 規則,而且會停用 Blob 服務的 CORS。

properties.defaultServiceVersion

string

如果未指定連入要求的版本,DefaultServiceVersion 會指出要用於 Blob 服務要求的預設版本。 可能的值包括 2008-10-27 版及所有更新版本。

properties.deleteRetentionPolicy

DeleteRetentionPolicy

Blob 虛刪除的 Blob 服務屬性。

properties.isVersioningEnabled

boolean

如果設定為 true,則會啟用版本控制。

properties.lastAccessTimeTrackingPolicy

LastAccessTimeTrackingPolicy

用來設定上次存取時間型追蹤原則的 Blob 服務屬性。

properties.restorePolicy

RestorePolicyProperties

Blob 還原原則的 Blob 服務屬性。

回應

名稱 類型 Description
200 OK

BlobServiceProperties

確定 -- 成功設定記憶體帳戶 Blob 服務的屬性。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

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

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

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"
  }
}

定義

名稱 Description
AllowedMethods

如果 CorsRule 元素存在,則為必要專案。 來源允許執行的 HTTP 方法清單。

BlobServiceProperties

記憶體帳戶 Blob 服務的屬性。

BlobServicesName

指定之記憶體帳戶內的 Blob 服務名稱。 Blob 服務名稱必須是 'default'

ChangeFeed

變更摘要事件的 Blob 服務屬性。

CorsRule

指定 Blob 服務的 CORS 規則。

CorsRules

設定 CORS 規則。 您可以在要求中包含最多五個 CorsRule 元素。

DeleteRetentionPolicy

虛刪除的服務屬性。

LastAccessTimeTrackingPolicy

上次存取時間型追蹤原則的 Blob 服務屬性。

name

此原則的名稱。 有效值為 AccessTimeTracking。 此欄位目前為唯讀

RestorePolicyProperties

Blob 還原原則的 Blob 服務屬性

Sku

記憶體帳戶的 SKU。

SkuName

SKU 名稱。 建立帳戶時需要;選擇性更新。 請注意,在舊版中,SKU 名稱稱為 accountType。

SkuTier

SKU 層。 這是以 SKU 名稱為基礎。

AllowedMethods

如果 CorsRule 元素存在,則為必要專案。 來源允許執行的 HTTP 方法清單。

名稱 類型 Description
CONNECT

string

DELETE

string

GET

string

HEAD

string

MERGE

string

OPTIONS

string

PATCH

string

POST

string

PUT

string

TRACE

string

BlobServiceProperties

記憶體帳戶 Blob 服務的屬性。

名稱 類型 Description
id

string

資源的完整資源識別碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

資源的名稱

properties.automaticSnapshotPolicyEnabled

boolean

已取代為isVersioningEnabled屬性。

properties.changeFeed

ChangeFeed

變更摘要事件的 Blob 服務屬性。

properties.containerDeleteRetentionPolicy

DeleteRetentionPolicy

容器虛刪除的 Blob 服務屬性。

properties.cors

CorsRules

指定 Blob 服務的 CORS 規則。 您可以在要求中包含最多五個 CorsRule 元素。 如果要求本文中未包含 CorsRule 元素,則會刪除所有 CORS 規則,而且會停用 Blob 服務的 CORS。

properties.defaultServiceVersion

string

如果未指定連入要求的版本,DefaultServiceVersion 會指出要用於 Blob 服務要求的預設版本。 可能的值包括 2008-10-27 版及所有更新版本。

properties.deleteRetentionPolicy

DeleteRetentionPolicy

Blob 虛刪除的 Blob 服務屬性。

properties.isVersioningEnabled

boolean

如果設定為 true,則會啟用版本控制。

properties.lastAccessTimeTrackingPolicy

LastAccessTimeTrackingPolicy

用來設定上次存取時間型追蹤原則的 Blob 服務屬性。

properties.restorePolicy

RestorePolicyProperties

Blob 還原原則的 Blob 服務屬性。

sku

Sku

Sku 名稱和階層。

type

string

資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”

BlobServicesName

指定之記憶體帳戶內的 Blob 服務名稱。 Blob 服務名稱必須是 'default'

名稱 類型 Description
default

string

ChangeFeed

變更摘要事件的 Blob 服務屬性。

名稱 類型 Description
enabled

boolean

指出 Blob 服務是否已啟用變更摘要事件記錄。

retentionInDays

integer

指出 changeFeed 保留天數的持續時間。 最小值為 1 天,最大值為 146000 天, (400 年) 。 Null 值表示變更摘要的無限保留期。

CorsRule

指定 Blob 服務的 CORS 規則。

名稱 類型 Description
allowedHeaders

string[]

如果 CorsRule 元素存在,則為必要專案。 允許成為跨原始來源要求一部分的標頭清單。

allowedMethods

AllowedMethods[]

如果 CorsRule 元素存在,則為必要專案。 來源允許執行的 HTTP 方法清單。

allowedOrigins

string[]

如果 CorsRule 元素存在,則為必要專案。 將透過 CORS 允許的原始網域清單,或 「*」 允許所有網域

exposedHeaders

string[]

如果 CorsRule 元素存在,則為必要專案。 要公開給 CORS 用戶端的回應標頭清單。

maxAgeInSeconds

integer

如果 CorsRule 元素存在,則為必要專案。 用戶端/瀏覽器應該快取預檢回應的秒數。

CorsRules

設定 CORS 規則。 您可以在要求中包含最多五個 CorsRule 元素。

名稱 類型 Description
corsRules

CorsRule[]

CORS 規則的清單。 您可以在要求中包含最多五個 CorsRule 元素。

DeleteRetentionPolicy

虛刪除的服務屬性。

名稱 類型 Description
allowPermanentDelete

boolean

當設定為 true 時,這個屬性允許刪除虛刪除的 Blob 版本和快照集。 此屬性無法使用 Blob 還原原則。 此屬性僅適用於 Blob 服務,不適用於容器或檔案共用。

days

integer

指出應保留已刪除專案的天數。 指定的最小值可以是 1,最大值可以是 365。

enabled

boolean

指出是否啟用DeleteRetentionPolicy。

LastAccessTimeTrackingPolicy

上次存取時間型追蹤原則的 Blob 服務屬性。

名稱 類型 Description
blobType

string[]

預先定義的支援 Blob 類型的數位。 只有 blockBlob 是支援的值。 此欄位目前為唯讀

enable

boolean

當設定為 true 時,會啟用上次以存取時間為基礎的追蹤。

name

name

此原則的名稱。 有效值為 AccessTimeTracking。 此欄位目前為唯讀

trackingGranularityInDays

integer

欄位會以天為單位指定 Blob 物件追蹤粒度,通常應該追蹤 Blob 物件的頻率。此欄位目前為唯讀,值為 1

name

此原則的名稱。 有效值為 AccessTimeTracking。 此欄位目前為唯讀

名稱 類型 Description
AccessTimeTracking

string

RestorePolicyProperties

Blob 還原原則的 Blob 服務屬性

名稱 類型 Description
days

integer

此 Blob 可以還原的時間長度。 它應該大於零且小於 DeleteRetentionPolicy.days。

enabled

boolean

如果設定為 true,則會啟用 Blob 還原。

lastEnabledTime

string

已取代為 minRestoreTime 屬性。

minRestoreTime

string

傳回可啟動還原的最小日期和時間。

Sku

記憶體帳戶的 SKU。

名稱 類型 Description
name

SkuName

SKU 名稱。 建立帳戶時需要;選擇性更新。 請注意,在舊版中,SKU 名稱稱為 accountType。

tier

SkuTier

SKU 層。 這是以 SKU 名稱為基礎。

SkuName

SKU 名稱。 建立帳戶時需要;選擇性更新。 請注意,在舊版中,SKU 名稱稱為 accountType。

名稱 類型 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

SKU 層。 這是以 SKU 名稱為基礎。

名稱 類型 Description
Premium

string

Standard

string