8
votes

I have a logic app that I am trying to automate through an ARM Template.

The logic app requires a connection to Office 365. Below I have the template for the connection generated from the automation pane of the Azure Portal.

When I run the script it fails - there is an authentication issue between the Azure subscription and the Office 365 subscription.

LinkedAuthorizationFailed

The client has permission to perform action 'Microsoft.Web/locations/managedApis/join/action' on scope ... however the current tenant 'curr-tenant-guid' is not authorized to access linked subscription 'linked-sub-guid' ...

I wont be able to create this trust to automate the provisioning, but I would like to create the connection as placeholder so that the logic app can be deployed and I can go back to the portal to authorise the connection. Is this possible? Are there any other alternatives?

 {
      "comments": "Office 365 user for file monitoring",
      "type": "Microsoft.Web/connections",
      "name": "MyOffice365User",
      "apiVersion": "2016-06-01",
      "location": "northeurope",
      "scale": null,
      "properties": {
        "displayName": "[email protected]",
        "customParameterValues": {},
        "api": {
          "id": "[concat('/subscriptions/a6720ff8-f7cb-4bc8-a542-e7868767686/providers/Microsoft.Web/locations/northeurope/managedApis/', 'MyOffice365User')]"
        }
      },
      "dependsOn": []
    }
2
Yeah there is no documentation on this subject. Please follow this article and you will be able to know which parameters have to be populated: blogs.msdn.microsoft.com/logicapps/2016/02/23/…Thomas
Do you want to post that up as an answer? It helped me find the solution.Murray Foxcroft
I ve added an answer, feel free to update it if you thing there are some important information to add.Thomas

2 Answers

4
votes

I found three post related to the same problem:

The problem is the same for all API Connection. Connection parameters to access the specific service are stored on Azure and when you try to export the ARM Template there is nothing regarding these specific parameters (which make sens as Azure will not expose your secret, password...).

The trick is to query Azure Resource Management API to return the parameters needed for any connection in a Logic App.

Just follow the instructions on this article:

0
votes

Use the below link to install logic app tool which can help to design workflow https://marketplace.visualstudio.com/items?itemName=VinaySinghMSFT.AzureLogicAppsToolsforVisualStudio-18551

once done you can create office 365 connector and when you open ARM template you can see o365 component in the ARM template. My template looks like :-

{
  "type": "MICROSOFT.WEB/CONNECTIONS",
  "apiVersion": "2016-06-01",
  "name": "[parameters('office365_1_Connection_Name')]",
  "location": "[parameters('location')]",
  "properties": {
    "api": {
      "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('location'), '/managedApis/', 'office365')]"
    },
    "displayName": "[parameters('office36`enter code here`5_1_Connection_DisplayName')]"
  }
}

and inside workflow

"triggers": {
            "When_a_new_event_is_created_(V2)": {
              "type": "ApiConnection",
              "inputs": {
                "host": {
                  "connection": {
                    "name": "@parameters('$connections')['office365']['connectionId']"
                  }
                },
                "method": "get",
                "path": "/datasets/calendars/v2/tables/@{encodeURIComponent(encodeURIComponent('AAMkNbPwESLK3F8s5n1Q3BwAhXXXXXXXXXXXXXXXXXXXXXXXXXXX'))}/onnewitems"
              },
              "recurrence": {
                "frequency": "Minute",
                "interval": 1
              },
              "splitOn": "@triggerBody()?['value']"
            }
          }

================================================================ And the parameters for workflow

"parameters": {
          "$connections": {
            "value": {
              "office365": {
                "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('location'), '/managedApis/', 'office365')]",
                "connectionId": "[resourceId('Microsoft.Web/connections', parameters('office365_1_Connection_Name'))]",
                "connectionName": "[parameters('office365_1_Connection_Name')]"
              }

================================================================