1
votes

Logic app connectors are closed source and the 'Automation Script' option in the Azure portal strips the authentication portions of the properties node from connectors. This is what the portal hands you when you script out the ARM template for a logic app which talks to CRM.

    {
        "comments": "Generalized from resource: '/subscriptions/<guid>/resourceGroups/<resource group name>/providers/Microsoft.Web/connections/dynamicsCRMconnector'.",
        "type": "Microsoft.Web/connections",
        "name": "[parameters('connections_dynamicsCRMconnector_name')]",
        "apiVersion": "2016-06-01",
        "location": "eastus",
        "scale": null,
        "properties": {
            "displayName": "CRMConnection",
            "customParameterValues": {},
            "api": {
                "id": "/subscriptions/<guid>/providers/Microsoft.Web/locations/eastus/managedApis/dynamicscrmonline"
            }
        },
        "dependsOn": []
    }

The other connectors (SFTP, storage account, etc.) have the missing elements node documented here and there (nothing official from MS, but blog posts and sample code) but I can't find the information for the Dynamics connectors. As an example of what I would expect to see, here is how SFTP and storage accounts can be pre-configured with authentication values in ARM:

{
  "type": "Microsoft.Web/connections",
  "apiVersion": "2016-06-01",
  "name": "[variables('sftp_conn_friendly_name')]",
  "location": "[resourceGroup().location]",
  "properties": {
    "displayName": "SFTP connection",
    "parameterValues": {
      "hostName": "[variables('sftp_host')]",
      "userName": "[variables('sftp_user')]",
      "password": "[variables('sftp_pass')]",
      "portNumber": "[variables('sftp_port')]",
      "giveUpSecurityAndAcceptAnySshHostKey": true,
      "disableUploadFilesResumeCapability": false
    },
    "api": {
      "id": "[variables('sftp_conn_managed_id')]"
    }
  }
},
{
  "type": "Microsoft.Web/connections",
  "apiVersion": "2016-06-01",
  "name": "[variables('storage_conn_friendly_name')]",
  "location": "[resourceGroup().location]",
  "properties": {
    "displayName": "Blob connection",
    "parameterValues": {
      "accountName": "[variables('storage_account_name')]",
      "accessKey": "[listKeys(variables('storage_account_name'),'2015-05-01-preview').key1]"
    },
    "api": {
      "id": "[variables('storage_conn_managed_id')]"
    }
  }
}
1

1 Answers

0
votes

While not a direct answer to your question, but a more general answer giving you idea how to act in such a situation. If its not documented anywhere your only hope is reversing it (and more often than not it works).

First of all, this connecter is a resource in Azure (like the ones you've written). You can use any of the available ways to get the resource properties (https://resource.azure.com, Get-AzureRmResource, REST API, various SDKs) and see what the values are like there.

Another way of going about this - creating this connector using the portal and capturing traffic with fiddler. That way you will see the exact REST call needed to créate such a connector and would be able to replicate it using ARM Template. You might not know that ARM Templates are basically proxies for REST calls. Each resource you are creating is being converted to a REST call and performed against the appropriate resource provider.