azure - 使用 Azure 流分析托管标识通过 terraform 访问 SQL DB

标签 azure terraform azure-stream-analytics azure-managed-identity

可以选择从 terraform 为流分析作业创建托管身份(azurerm_stream_analytics_job,使用身份 block )。

并且可以使用托管身份连接到数据库(如所述 here )

但我找不到如何使用托管身份来使用 azurerm_stream_analytics_reference_input_mssql

创建输入

更新:

要明确的是,这就是我所追求的: enter image description here 进而 enter image description here

最佳答案

截至 2022 年 7 月

看起来 terraform 不支持它(请参阅 documentation )。

通过这个arm模板,我能够部署("authenticationMode": "Msi"):

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "streamAnalyticsJobName": {
      "type": "string"
    },
    "streamAnalyticsJobNameInputName": {
      "type": "string"
    },
    "sqlServerName": {
      "type": "string"
    },
    "databaseName": {
      "type": "string"
    }
  },
  "resources": [
    {
      "type": "Microsoft.StreamAnalytics/streamingjobs/inputs",
      "apiVersion": "2017-04-01-preview",
      "name": "[format('{0}/{1}', parameters('streamAnalyticsJobName'), parameters('streamAnalyticsJobNameInputName'))]",
      "properties": {
        "type": "Reference",
        "datasource": {
          "type": "Microsoft.Sql/Server/Database",
          "properties": {
            "authenticationMode": "Msi",
            "server": "[parameters('sqlServerName')]",
            "database": "[parameters('databaseName')]",
            "refreshType": "Static",
            "fullSnapshotQuery": "SELECT Id, Name, FullName\nFrom dbo.Device\nFOR SYSTEM_TIME AS OF @snapshotTime --Optional, available if table Device is temporal"
          }
        }
      }
    }
  ]
}

因此,您始终可以使用 azurerm_template_deployment 资源来使用 terraform 进行部署。

关于azure - 使用 Azure 流分析托管标识通过 terraform 访问 SQL DB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73148403/

相关文章:

amazon-web-services - Terraform 无法承担启用 MFA 的角色

nginx - 陷入 Terraform 到 Kubernetes 的部分 helm 发布中

azure - 无法将 Azure Function 添加为流分析作业输出

Azure 数据工厂 (ADFv2) - 如何处理 USQL 作业中不同文件夹中的多个输入文件

c# - 隔离功能应用程序不响应 HTTP 调用

azure - 在 terraform 中,使字符串变量在操作 block 中可选

azure - 使用流分析将数据从 IoT 中心传输到 Cosmos DB 会出现分区错误

c# - 使用 FTP 从 Azure WebJobs 发送文件

terraform - Terraform 变量中引用了未知资源

azure - Azure 流分析 SAQL 中满足条件时的默认字段值