【发布时间】:2021-09-27 12:16:47
【问题描述】:
我仍然不熟悉 azure bicep,但我真的很喜欢微软到目前为止所做的事情。
我仍在学习它的语法和基础知识,但我被困在了这一点上。
我正在尝试做的是复制存储帐户的创建并设置一些配置,例如minimum_tls_versionDeleteRetentionPolicy 等。
我正在尝试循环创建它,因此我可以使用相同的配置创建多个存储。
到此为止。
param storageAccounts array = [
'storage2'
]
resource storage_Accounts 'Microsoft.Storage/storageAccounts@2021-04-01' = [ for storageName in storageAccounts :{
name: [storageName]
location: 'westeurope'
sku: {
name: 'Standard_RAGRS'
tier: 'Standard'
}
kind: 'StorageV2'
properties: {
allowCrossTenantReplication: true
minimumTlsVersion: 'TLS1_2'
allowBlobPublicAccess: false
allowSharedKeyAccess: true
networkAcls: {
bypass: 'AzureServices'
virtualNetworkRules: []
ipRules: []
defaultAction: 'Allow'
}
supportsHttpsTrafficOnly: true
encryption: {
services: {
file: {
keyType: 'Account'
enabled: true
}
blob: {
keyType: 'Account'
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
accessTier: 'Hot'
}
}]
resource storage_Accounts_name_default 'Microsoft.Storage/storageAccounts/blobServices@2021-04-01' = [ for storageName in storageAccounts :{
parent: storage_Accounts
name: [storageName]
properties: {
changeFeed: {
enabled: false
}
restorePolicy: {
enabled: false
}
containerDeleteRetentionPolicy: {
enabled: true
days: 7
}
cors: {
corsRules: []
}
deleteRetentionPolicy: {
enabled: true
days: 30
}
isVersioningEnabled: true
}
}]
此时,在最后一行 }] 我收到以下错误:
Expected the "}" character at this location.bicep(BCP018)
Expected the "]" character at this location.bicep(BCP018)
我不明白为什么会出现这个语法错误,所有 }] 似乎都是正确的。
有人认为我不明白的是这个。当我手动创建存储帐户时,Soft delete etc 的策略配置是在存储帐户级别进行的。但是按照文档,此配置是在单个 blob storage 完成的。
谁能给我解释一下这个和最好的方法吗?
非常感谢您提供的任何帮助
【问题讨论】:
标签: azure azure-devops azure-bicep