azure - 使用 Terraform 阻止允许共享访问 key

标签 azure terraform azure-storage terraform-provider-azure azure-rm

嘿,我目前正在使用 Terraform v0.12.28 和提供程序 azurerm v2.22.0,我想在 Azure 存储配置中禁用(允许共享访问 key 、允许 Blob 公共(public)访问并使用 TLS1_2)以确保其安全,我发现“allow_blob_public_access = false”和“min_tls_version =”TLS1_2”,但无法找到禁用允许共享访问 key 的参数。

resource "azurerm_storage_account" "main" {
  name                     = var.storage_account_name
  resource_group_name      = azurerm_resource_group.main.name
  location                 = azurerm_resource_group.main.location
  account_tier             = var.account_tier
  account_replication_type = var.account_replication_type
  allow_blob_public_access = false
  min_tls_version = "TLS1_2"
  

}  

最佳答案

Terraform 中没有设置允许共享访问 key 的选项,这只是意味着 Terraform 不支持此功能,并且 Azure 中的此功能也是预览版本。还有另一种方法可以在 Azure 门户旁边设置允许共享访问 key

这种方式是通过Terraform中的local-exec来使用Azure CLI:

resource "null_resource" "example" {
  provisioner "local-exec" {
    command = "az resource update --ids ${azurerm_storage_account.main.id} --set properties.allowSharedKeyAccess=false"
  }
}

您可以获得有关允许共享访问 key 的更多详细信息here .

关于azure - 使用 Terraform 阻止允许共享访问 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66244572/

相关文章:

Azure 移动服务 Facebook 登录无需用户名/密码

azure - 将对象更新到 Azure 表存储 - 有没有办法获取新的时间戳?

地形 : depends_on argument not creating the specified resource first

google-cloud-platform - 如何将公共(public)和私有(private)保留 IP 附加到 GCE 实例?

Azure 存储错误 : "The specified blob already exists", 但事实并非如此!

azure - 我怎样才能获得可以传递给azure rest api的不记名 token

terraform - 迭代 Terraform 动态 block 内的单个 map

.net - 无法在 StorageException 处理程序中续订 Windows Azure SAS key

node.js - 如何使用Azure存储表和 Node js查找以特定字符开头的任何值

azure - 在 .NET Core 控制台应用程序中以编程方式创建 New-AzureRmRoleAssignment