gpt4 book ai didi

azure - 使用 Bicep 模板 Azure 添加 Blob 存储的生命周期管理规则

转载 作者:行者123 更新时间:2023-12-03 05:25:13 25 4
gpt4 key购买 nike

我正在构建一个 azure 的二头肌文件来部署 Azure 资源。

在同一个二头肌文件中,我创建一个存储帐户、几个容器和一些管理策略。在 Microsoft 文档中:

Before you configure a lifecycle management policy, you can choose to enable blob access time tracking. When access time tracking is enabled, a lifecycle management policy can include an action based on the time that the blob was last accessed with reading or write operation.

虽然我按照文档启用上次访问时间跟踪策略,并在同一个二头肌文件中运行管理策略,但我仍然遇到此错误:

"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details. Last access time based tracking policy must be enabled before using its specific actions in object lifecycle management policy"

这是我的二头肌文件:

resource storage_account_blob 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: 'test'
location: 'East US'
sku: {
name: 'Standard_RAGRS'
}
kind: 'StorageV2'

properties: {
networkAcls: {
bypass: 'AzureServices'
virtualNetworkRules: []
ipRules: []
defaultAction: 'Allow'
}

supportsHttpsTrafficOnly: true
encryption: {
services: {
file: {
keyType: 'Account'
enabled: true
}
blob: {
keyType: 'Account'
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
}
}

resource blobStorageService 'Microsoft.Storage/storageAccounts/blobServices@2019-06-01' = {
parent: storage_account_blob
name: 'default'
properties: {
lastAccessTimeTrackingPolicy: {
blobType: [
'string'
]
enable: true
name: 'AccessTimeTracking'
trackingGranularityInDays: 1
}
}
}

resource blobStorage_container_input 'Microsoft.Storage/storageAccounts/blobServices/containers@2019-06-01' = {
name: 'input'
properties: {
defaultEncryptionScope: '$account-encryption-key'
denyEncryptionScopeOverride: false
publicAccess: 'None'
}
parent: blobStorageService
}

resource management_policies 'Microsoft.Storage/storageAccounts/managementPolicies@2019-06-01' = {
name: 'default'
properties: {
policy:{
rules: [
{
definition:{
actions:{
baseBlob:{
delete:{
daysAfterLastAccessTimeGreaterThan: 60
}
tierToArchive:{
daysAfterLastAccessTimeGreaterThan: 30
}
tierToCool:{
daysAfterLastAccessTimeGreaterThan:15
}
}
}
filters:{
blobTypes:[
'blockBlob'
]
}
}
enabled: true
name: 'testRules'
type: 'Lifecycle'
}
]
}
}
parent: storage_account_blob
}

在创建生命周期管理策略之前,我是否必须首先使用 Blob 服务创建存储帐户?

最佳答案

我不确定,但是您是否尝试过在“资源管理策略”上设置“取决于”并将其指向“资源 blobStorageService”。

关于azure - 使用 Bicep 模板 Azure 添加 Blob 存储的生命周期管理规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69510140/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com