【问题标题】:Terraform identity access for ADF and storage accountADF 和存储帐户的 Terraform 身份访问
【发布时间】:2023-03-04 11:18:01
【问题描述】:

我想使用我知道怎么做的 terraform 创建 ADF 和存储帐户。在此之后,我想授予 ADF 身份访问存储帐户的权限。我可以使用 powershell 来做到这一点。但是当我使用 powershell 时会出现幂等性问题。是否可以在不使用powershell的情况下使用terraform本身实现访问?

【问题讨论】:

    标签: azure terraform-provider-azure


    【解决方案1】:

    您应该创建一个azurerm_role_assignment 以授予 ADF 对 Azure 存储帐户的访问权限。

    请检查以下示例。此代码 sn-p 将 Storage Blob Data Reader 角色分配给 ADF。

    resource "azurerm_resource_group" "example" {
      name     = "example-resources"
      location = "West Europe"
    }
    
    resource "azurerm_data_factory" "example" {
      name                = "example524657"
      location            = azurerm_resource_group.example.location
      resource_group_name = azurerm_resource_group.example.name
    
      identity {
        type = "SystemAssigned"
      }
    }
    
    resource "azurerm_storage_account" "example" {
      name                     = "examplestr524657"
      resource_group_name      = azurerm_resource_group.example.name
      location                 = azurerm_resource_group.example.location
      account_tier             = "Standard"
      account_replication_type = "RAGRS"
    }
    
    resource "azurerm_role_assignment" "example" {
      scope                = azurerm_storage_account.example.id
      role_definition_name = "Storage Blob Data Reader"
      principal_id         = azurerm_data_factory.example.identity[0].principal_id
    }
    

    【讨论】:

      猜你喜欢
      • 2018-10-11
      • 2019-07-28
      • 2021-12-05
      • 2021-10-29
      • 2020-06-14
      • 2012-08-24
      • 1970-01-01
      • 2021-10-12
      • 1970-01-01
      相关资源
      最近更新 更多