azure - ADF 和存储帐户的 Terraform 身份访问
问题描述
我想使用我知道怎么做的 terraform 创建 ADF 和存储帐户。在此之后,我想授予 ADF 身份访问存储帐户的权限。我可以使用 powershell 来做到这一点。但是当我使用 powershell 时会出现幂等性问题。是否可以在不使用 powershell 的情况下使用 terraform 本身实现访问?
解决方案
您应该创建一个azurerm_role_assignment
授予 ADF 访问 Azure 存储帐户的权限。
请检查下面的示例。此代码段将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
}
推荐阅读
- javascript - 在 Gitlab Servicedesk 功能中将收集的电子邮件作为新票证/问题发送
- php - 评级值始终插入为 1
- python - Django中OAuth1.0a的验证POST请求
- python - 在 python 中使 Eratosthenes 的筛子更有效率?
- c# - ASP.NET Core 单元测试在测试控制器问题响应时抛出 Null Exception
- ansible - 错误消息中存在字符串时忽略失败
- php - Facebook集成:如何实现非规范元数据抓取
- npm - IBM uDeploy 无法从工件中检索 npm 版本
- node.js - 错误:BotFrameworkAdapter.processActivity():401 错误
- python - 为什么我不能使用 paramiko 在远程服务器上运行“support show db-status free %”?