使用ARM模板通过服务主体身份验证为Azure数据工厂创建API连接
我已经创建了一个使用azure data factory连接器的逻辑应用程序 我可以从门户创建带有服务主体身份验证的使用ARM模板通过服务主体身份验证为Azure数据工厂创建API连接,azure,azure-resource-manager,azure-logic-apps,Azure,Azure Resource Manager,Azure Logic Apps,我已经创建了一个使用azure data factory连接器的逻辑应用程序 我可以从门户创建带有服务主体身份验证的API连接: 但我找不到任何关于如何使用ARM模板创建API连接的文档 但我需要使用具有相同服务主体身份验证的ARM模板进行创建。我在visual studio 2019中进行了一些测试,因为VS将尽可能多地显示ARM模板的内容(有时显示的内容比Azure portal中的多)。我安装了“Azure Logic Apps Tools for Visual Studio 2019”
API连接
:
但我找不到任何关于如何使用ARM模板创建API连接的文档
但我需要使用具有相同服务主体身份验证的ARM模板进行创建。我在visual studio 2019中进行了一些测试,因为VS将尽可能多地显示ARM模板的内容(有时显示的内容比Azure portal中的多)。我安装了“Azure Logic Apps Tools for Visual Studio 2019”,然后在VS2019中创建了我的Logic app。添加“创建管道运行”操作后,单击VS2019中的“代码视图”。模板显示如下:
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Create_a_pipeline_run": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuredatafactory_2']['connectionId']"
}
},
"method": "post",
"path": "/subscriptions/@{encodeURIComponent('**********')}/resourcegroups/@{encodeURIComponent('andywebbot')}/providers/Microsoft.DataFactory/factories/@{encodeURIComponent('andydatafactory2')}/pipelines/@{encodeURIComponent('pipeline1')}/CreateRun",
"queries": {
"x-ms-api-version": "2017-09-01-preview"
}
},
"runAfter": {}
}
},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"type": "Recurrence",
"recurrence": {
"frequency": "Month",
"interval": 3
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {}
}
我们可以看到模板没有向我们显示连接的详细信息(例如“tenantId”、“客户端ID”和“客户端机密”)。因此,恐怕我们无法使用ARM模板来创建服务主体。您可以使用ARM模板为Azure Data factory创建API连接,如下所示:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connectionAPIName": {
"type": "string"
},
"clientId": {
"type": "string"
},
"clientSecret": {
"type": "securestring"
}
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2018-07-01-preview",
"name": "[parameters('connectionAPIName')]",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "[parameters('connectionAPIName')]",
"parameterValues": {
"token:clientId": "[parameters('clientId')]",
"token:clientSecret": "[parameters('clientSecret')]",
"token:TenantId": "[subscription().tenantId]",
"token:grantType": "client_credentials"
},
"api": {
"id": "[concat('subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuredatafactory')]"
}
}
}
],
"outputs": {}
}
谢谢@Thomas,很有效。你能告诉我这些密钥(clientId,clientSecret)是在哪里定义的吗。有文件吗。因为我需要相同的cosmosDB连接,我需要在其中放置“accountId”、“accessKey”等。我从未找到任何关于这方面的文档。我所做的是在手动创建连接器之前在azure portal上打开
开发者工具
,然后我可以看到ARM请求。。。我知道这有点痛苦,但这是我找到的最简单的方法。@Thomas:我已按说明部署了连接器,但连接器报告为“未经验证”。您是否遇到过类似的情况?您以前是否运行过connect azaccount
?