我们正在将 ARM 模板升级到 Bicep,其中之一用于存储。在最初移植的 Bicep 文件中,一切正常,然后作为我的 PR 的一部分,突出显示我遗漏了 isHnsEnabled
。
然后,当我们创建模块库时,我调整了我的二头肌脚本以包含带有参数的属性设置:
param saName string
param storageSku string
param tags object
param isHnsEnabled bool
resource storageaccount 'Microsoft.Storage/storageAccounts@2021-04-01' = {
name: saName
location: resourceGroup().location
tags: tags
sku: {
name: storageSku
}
kind: 'StorageV2'
identity: {
type: 'SystemAssigned'
}
properties: {
minimumTlsVersion: 'TLS1_2'
allowBlobPublicAccess: false
allowCrossTenantReplication: false
allowSharedKeyAccess: true
isHnsEnabled: isHnsEnabled
networkAcls: {
virtualNetworkRules: []
defaultAction: 'Deny'
}
encryption: {
keySource: 'Microsoft.Storage'
services: {
file: {
keyType: 'Account'
enabled: true
}
}
}
}
}
output name string = storageaccount.name
output id string = storageaccount.id
output identity string = storageaccount.identity.principalId
这会产生以下错误:
The property 'isHnsEnabled' was specified in the input, but it cannot be updated as it is read-only
我不确定是否需要与此属性结合设置其他属性,但 Microsoft 文档中没有任何内容表明这一点。我会假设如果资源已创建且属性匹配,则 Bicep 不会尝试这样做通过 CICD 更改资源。
如有任何建议,我们将不胜感激。
最佳答案
isHnsEnabled
属性(用于启用分层命名空间)只能在创建新资源时设置。
您可以查看这篇文章以了解何时启用此功能: Deciding whether to enable a hierarchical namespace .
要升级您的存储,您可以按照以下文章操作:Upgrade Azure Blob Storage with Azure Data Lake Storage Gen2 capabilities .
否则,您可以删除并重新创建存储帐户。
关于azure - Bicep isHnsEnabled 无法更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71115316/