azure - 使用连接器更新 Azure ARM 模板
问题描述
我使用 ARM 模板部署通过 office365 连接器发送邮件的逻辑应用程序。部署它可以正常工作,但是如果我更新模板并想要重新部署它,则与 office365 的连接器断开连接,我必须再次授权连接。当我想更新逻辑应用程序时,有什么方法可以避免断开连接器?
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"env_suffix": {
"defaultValue": null,
"type": "String"
}
},
"variables": {
"workflow_name": "[concat('GoMail', parameters('env_suffix'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"location": "[resourceGroup().location]",
"name": "office365",
"properties": {
"api": {
"id": "[concat(subscription().id,'/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
},
"displayName": "office365",
"parameterValues": {
}
}
},
{
"type": "Microsoft.Logic/workflows",
"name": "[variables('workflow_name')]",
"apiVersion": "2017-07-01",
"location": "westeurope",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', 'office365')]"
],
"tags": {},
"scale": null,
"properties": {
"state": "Enabled",
"parameters": {
"$connections": {
"value": {
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', 'office365')]",
"connectionName": "office365",
"id": "[concat(subscription().id,'/providers/Microsoft.Web/locations/westeurope/managedApis/office365')]"
}
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {},
"else": {
"actions": {
"Condition_2": {
"actions": {
"Send_an_email_2": {
"inputs": {
"body": {
"Body": "@{base64ToString(triggerBody()?['payload'])}",
"From": "@triggerBody()?['from']",
"Importance": "Normal",
"IsHtml": true,
"Subject": "@triggerBody()?['subject']",
"To": "mailme@company.com"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/Mail"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"else": {
"actions": {
"Until": {
"actions": {
"Delay": {
"inputs": {
"interval": {
"count": 10,
"unit": "Second"
}
},
"runAfter": {
"Send_an_email_3": [
"Failed"
]
},
"type": "Wait"
},
"Send_an_email_3": {
"inputs": {
"body": {
"Body": "@{base64ToString(triggerBody()?['payload'])}",
"From": "noreply@company.com",
"Importance": "Normal",
"IsHtml": true,
"Subject": "@triggerBody()?['subject']",
"To": "@triggerBody()?['email']"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/Mail"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"expression": "@equals(outputs('Send_an_email_3')['statusCode'], 200)",
"limit": {
"count": 5,
"timeout": "PT5M"
},
"runAfter": {},
"type": "Until"
}
}
},
"expression": "@endswith(triggerBody()?['email'], 'integtest.com')",
"runAfter": {},
"type": "If"
}
}
},
"expression": "@equals(triggerBody()?['email'], 'ping')",
"runAfter": {},
"type": "If"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {
"properties": {
"email": {
"type": "string"
},
"payload": {
"type": "string"
},
"subject": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
}
}
}
}
}
]
}
解决方案
如果通过模板重新部署逻辑应用,则应断开连接。我认为您不能与模板一起授权连接。连接器由 azure AD 授权,ARM 模板仅包含您订阅的资源,但不包含 azure AD 层,azure ad 位于订阅之上。
这是微软回答的类似问题,你可以看看。
解析度:
根据观察,我与专家进行了讨论,似乎连接器目前只能进行 Windows AD 身份验证,因此出现了问题。产品组在待办事项中有此功能更新,并将在未来几天更新连接器,我们还没有关于此的 ETA。
它说该功能将在未来几天更新,如果该功能支持powershell,我认为它可能会支持ARM模板,因为这两种方式本质上应该调用相同的rest api。
推荐阅读
- javascript - webpack babel loader with eslint laoder
- mysql - 无法在mysql中声明变量
- angular - Angular 9 ng-if 和 ng-show - 始终显示元素
- javascript - 单击按钮执行功能时页面会闪烁,但预期的结果永远不会发生
- javascript - 导航栏不以反应状态隐藏
- python - Dask 可视化方法图像尺寸太小
- android - 有没有办法组合来自不同维度的数据?
- c# - ICommand HasErrors 不会冒泡到父级
- javascript - 将 Discord Bot 活动设置为在线用户数。不和谐.js
- matlab - 绘制惠斯通电桥电路的输出电压