azure - Bicep isHnsEnabled 无法更新

标签 azure azure-resource-manager azure-data-lake-gen2 azure-bicep

我们正在将 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/

相关文章:

c# - 如何使用应用程序级身份验证/访问 token 访问 Sharepoint 文件?

c# - 如何检索 azure AD 用户及其所有属性

mongodb - 操作系统类型“Linux”不支持每个处理程序多个 VMExtension

apache-spark - Azure Data Lake Gen 2 存储中的 Parquet 与 Delta 格式

ADLS Gen2 中文件的 Java 文件对象

azure - 处理 cosmos db 中同一对象的两个 upsert

azure - 如何在 Azure 资源管理器模板中为 Azure 函数配置应用服务托管证书?

azure - 从 Bicep 获取 Log Analytics 工作区 key

azure - 权限_拒绝 : Invalid permissions on the specified KeyVault

azure - 新对象 : Cannot find type [Microsoft. Open.AzureAD.Model.DomainFederationSettings]:验证程序集