Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARM template Office 365 connection for logic apps

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": []
    }
like image 905
Murray Foxcroft Avatar asked Apr 09 '18 13:04

Murray Foxcroft


1 Answers

I found three post related to the same problem:

  • Deploying a logic app using ARM templates/powershell
  • Azure Logic Apps - ARM template to deploy filesystem API connection
  • How to set the connection string for a Service Bus Logic App action in an ARM template?

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:

  • Deploying in the Logic Apps Preview Refresh
like image 131
Thomas Avatar answered Sep 28 '22 02:09

Thomas