简体   繁体   English

使用存储帐户和 Office 365 连接器部署逻辑应用

[英]Deploying Logic Apps with storage account and office 365 connector

I'm trying to deploy a logic app which includes an office 365 connector and a storage account.我正在尝试部署一个包含 Office 365 连接器和存储帐户的逻辑应用程序。 Is it better to include the storage account and office365 connector in the ARM template or create the connectors in the resource group before deployment?是在 ARM 模板中包含存储帐户和 office365 连接器还是在部署前在资源组中创建连接器更好? In this case, I'm finding that the blob actions are saying they can't find the account.在这种情况下,我发现 blob 操作说他们找不到帐户。 If I deploy everything together, I need to manually go through all the actions and reset the connector when I deploy to a new resource group.如果我将所有内容部署在一起,则需要手动完成所有操作并在部署到新资源组时重置连接器。 I can't expect an operations team to do this.我不能指望一个运营团队来做这件事。 What's the best practice?最佳做法是什么?

For this problem, we can solve the issue of blob by modify our arm template but we can't solve the issue of o365 in arm template.对于这个问题,我们可以通过修改我们的arm模板来解决blob的问题,但是不能解决arm模板中o365的问题。

To connect to your blob storage after deploy the arm template, you can refer to my logic and arm template and edit your arm template.要在部署arm模板后连接到您的blob存储,您可以参考我的逻辑和arm模板并编辑您的arm模板。 My logic app shown as below:我的逻辑应用程序如下所示: 在此处输入图片说明

And my arm template show as below:我的手臂模板显示如下:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "metadata": {
        "description": "Name of the Logic App."
      }
    },
    "logicAppLocation": {
      "type": "string",
      "defaultValue": "eastasia",
      "allowedValues": [
        "[resourceGroup().location]",
        "eastasia",
        "southeastasia",
        "centralus",
        "eastus",
        "eastus2",
        "westus",
        "northcentralus",
        "southcentralus",
        "northeurope",
        "westeurope",
        "japanwest",
        "japaneast",
        "brazilsouth",
        "australiaeast",
        "australiasoutheast",
        "southindia",
        "centralindia",
        "westindia",
        "canadacentral",
        "canadaeast",
        "uksouth",
        "ukwest",
        "westcentralus",
        "westus2",
        "koreacentral",
        "koreasouth",
        "francecentral",
        "francesouth",
        "uaecentral",
        "southafricanorth",
        "southafricawest"
      ],
      "metadata": {
        "description": "Location of the Logic App."
      }
    },
    "azureblob_1_Connection_Name": {
      "type": "string",
      "defaultValue": "azureblob"
    },
    "azureblob_1_Connection_DisplayName": {
      "type": "string",
      "defaultValue": "blobConnection"
    },
    "azureblob_1_accountName": {
      "type": "string",
      "metadata": {
        "description": "Name of the storage account the connector should use."
      },
      "defaultValue": "hurystorage"
    },
    "azureblob_1_accessKey": {
      "type": "securestring",
      "metadata": {
        "description": "Specify a valid primary/secondary storage account access key."
      }
    },
    "office365_1_Connection_Name": {
      "type": "string",
      "defaultValue": "office365"
    },
    "office365_1_Connection_DisplayName": {
      "type": "string",
      "defaultValue": "myemail@email.com"
    }
  },
  "variables": {},
  "resources": [
    {
      "name": "[parameters('logicAppName')]",
      "type": "Microsoft.Logic/workflows",
      "location": "[parameters('logicAppLocation')]",
      "tags": {
        "displayName": "LogicApp"
      },
      "apiVersion": "2016-06-01",
      "properties": {
        "definition": {
          "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
          "actions": {
            "Get_blob_content": {
              "type": "ApiConnection",
              "inputs": {
                "host": {
                  "connection": {
                    "name": "@parameters('$connections')['azureblob']['connectionId']"
                  }
                },
                "method": "get",
                "path": "/datasets/default/files/@{encodeURIComponent(encodeURIComponent('JTJmdGVzdGNvbnRhaW5lciUyZmZpbGUxLmNzdg=='))}/content",
                "queries": {
                  "inferContentType": true
                }
              },
              "runAfter": {},
              "metadata": {
                "JTJmdGVzdGNvbnRhaW5lciUyZmZpbGUxLmNzdg==": "/testcontainer/file1.csv"
              }
            },
            "Send_an_email_(V2)": {
              "type": "ApiConnection",
              "inputs": {
                "host": {
                  "connection": {
                    "name": "@parameters('$connections')['office365']['connectionId']"
                  }
                },
                "method": "post",
                "body": {
                  "To": "test@mail.com",
                  "Subject": "test",
                  "Body": "<p>test</p>"
                },
                "path": "/v2/Mail"
              },
              "runAfter": {
                "Get_blob_content": [
                  "Succeeded"
                ]
              }
            }
          },
          "parameters": {
            "$connections": {
              "defaultValue": {},
              "type": "Object"
            }
          },
          "triggers": {
            "Recurrence": {
              "type": "recurrence",
              "recurrence": {
                "frequency": "Month",
                "interval": 1
              }
            }
          },
          "contentVersion": "1.0.0.0",
          "outputs": {}
        },
        "parameters": {
          "$connections": {
            "value": {
              "azureblob": {
                "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'azureblob')]",
                "connectionId": "[resourceId('Microsoft.Web/connections', parameters('azureblob_1_Connection_Name'))]",
                "connectionName": "[parameters('azureblob_1_Connection_Name')]"
              },
              "office365": {
                "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'office365')]",
                "connectionId": "[resourceId('Microsoft.Web/connections', parameters('office365_1_Connection_Name'))]",
                "connectionName": "[parameters('office365_1_Connection_Name')]"
              }
            }
          }
        }
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/connections', parameters('azureblob_1_Connection_Name'))]",
        "[resourceId('Microsoft.Web/connections', parameters('office365_1_Connection_Name'))]"
      ]
    },
    {
      "type": "MICROSOFT.WEB/CONNECTIONS",
      "apiVersion": "2018-07-01-preview",
      "name": "[parameters('azureblob_1_Connection_Name')]",
      "location": "[parameters('logicAppLocation')]",
      "properties": {
        "api": {
          "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'azureblob')]"
        },
        "displayName": "[parameters('azureblob_1_Connection_DisplayName')]",
        "parameterValues": {
          "accountName": "[parameters('azureblob_1_accountName')]",
          "accessKey": "[parameters('azureblob_1_accessKey')]"
        }
      }
    },
    {
      "type": "MICROSOFT.WEB/CONNECTIONS",
      "apiVersion": "2018-07-01-preview",
      "name": "[parameters('office365_1_Connection_Name')]",
      "location": "[parameters('logicAppLocation')]",
      "properties": {
        "api": {
          "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'office365')]"
        },
        "displayName": "[parameters('office365_1_Connection_DisplayName')]"
      }
    }
  ],
  "outputs": {}
}

Please pay attention to this part in screenshot in my template.请注意我模板截图中的这部分。

在此处输入图片说明

In my arm template, I just change the code from the screenshot above to:在我的手臂模板中,我只是将上面屏幕截图中的代码更改为:

"azureblob_1_accessKey": {
  "type": "securestring",
  "metadata": {
    "description": "Specify a valid primary/secondary storage account access key."
  },
  "defaultValue": "<your storage access key>"
},

Then deploy the arm template, it will connect to your blob storage.然后部署 arm 模板,它将连接到您的 blob 存储。

For the problem of o365 connector deployment by arm template, there isn't a good solution to implement it.对于arm模板部署o365连接器的问题,目前还没有很好的实现方案。 But you can refer to this post , it provides a solution of powershell to do the authencation for the o365 connector.但是你可以参考这个帖子,它提供了一个powershell的解决方案来对o365连接器进行身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM