[英]Update Azure ARM templates with connector
我使用 ARM 模板來部署通過 office365 連接器發送郵件的邏輯應用程序。 部署它工作正常,但如果我更新模板並想要重新部署它,office365 的連接器斷開連接,我必須再次授權連接。 當我想更新 logicapp 時,有什么方法可以避免斷開連接器?
{
"$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身份驗證,因此存在問題。 產品組在 backlog 中有此功能更新,並將在未來幾天更新連接器,我們還沒有關於此的 ETA。
它說該功能將在未來幾天更新,如果該功能支持powershell,我認為它可能會支持ARM模板,因為這兩種方式本質上應該調用相同的rest api。
您可以將 office365 Api 連接模板與邏輯應用程序模板分開,您只需將 Api 連接部署和授權一次,在您的邏輯應用程序中,您只需使用授權的 Api 連接。
其實這取決於你使用的api連接的類別,如果不是需要MFA授權的api連接(office365、outlook、keyvault custom connector、Dynamics CRM、salesforce),你可以把你的api連接模板和你的邏輯應用程序模板。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.