Deploy API Connection using ARM

Azure API Connections have a name and a display name. When you create a new API Connection via the Azure Portal, you are not able to specify the name of the API Connection. This name is actually used in Logic Apps however. Example: @parameters(‘$connections’)[‘sftp_1’][‘connectionId’] In this case sftp_1 is the name, not the display name. If you deploy this logic app from DEV to ACC, you might run into problems when connection name sftp_1 refers to a different FTP server. The only way around this, is to create the API Connection via Powershell using an ARM template. The ARM template will create a resource of type Microsoft.Web/connections. Example ARM Template: { “$schema”: “”, “contentVersion”: “”, “parameters”: { “logicAppLocation”: { “type”: “string”, “defaultValue”: “[resourceGroup().location]”, “allowedValues”: [ “[resourceGroup().location]”, “eastasia”, “southeastasia”, “centralus”, “eastus”, “eastus2”, “westus”, “northcentralus”, “southcentralus”, “northeurope”, “westeurope”, “japanwest”, “japaneast”, “brazilsouth”, “australiaeast”, “australiasoutheast”, “westcentralus”, “westus2” ], “metadata”: { “description”: “Location of the Logic App.” } }, “sftp_name”: { “type”: “string”, “defaultValue”: “sftp” }, “sftp_displayName”: { “type”: “string”, “defaultValue”: “” }, “sftp_hostName”: { “type”: “string”, “defaultValue”: “”, “metadata”: { “description”: “Host Server Address” } }, “sftp_userName”: { “type”: “string”, “defaultValue”: “”, “metadata”: { “description”: “User Name” } }, “sftp_password”: { “type”: “securestring”, “defaultValue”: null, “metadata”: { “description”: “Password” } }, “sftp_portNumber”: { “type”: “int”, “defaultValue”: 22, “metadata”: { “description”: “SFTP Port Number (example: 22)” } }, “sftp_giveUpSecurityAndAcceptAnySshHostKey”: { “type”: “bool”, “defaultValue”: true, “metadata”: { “description”: “Disable SSH Host Key Validation? (True/False)” } }, “sftp_sshHostKeyFingerprint”: { “type”: “string”, “defaultValue”: “”, “metadata”: { “description”: “SSH Host Key Finger-print” } }, “sftp_disableUploadFilesResumeCapability”: { “type”: “bool”, “defaultValue”: false, “metadata”: { “description”: “Disable Resume Capability? (True/False)” } } }, “variables”: {}, “resources”: [ { “type”: “Microsoft.Web/connections”, “apiVersion”: “2016-06-01”, “location”: “[parameters(‘logicAppLocation’)]”, “name”: “[parameters(‘sftp_name’)]”, “properties”: { “api”: { “id”: “[concat(‘/subscriptions/’,subscription().subscriptionId,’/providers/Microsoft.Web/locations/’,parameters(‘logicAppLocation’),’/managedApis/sftp’)]” }, “displayName”: “[parameters(‘sftp_displayName’)]”, “parameterValues”: { “hostName”: “[parameters(‘sftp_hostName’)]”, “userName”: “[parameters(‘sftp_userName’)]”, “password”: “[parameters(‘sftp_password’)]”, “portNumber”: “[parameters(‘sftp_portNumber’)]”, “giveUpSecurityAndAcceptAnySshHostKey”: “[parameters(‘sftp_giveUpSecurityAndAcceptAnySshHostKey’)]”, “sshHostKeyFingerprint”: “[parameters(‘sftp_sshHostKeyFingerprint’)]”, “disableUploadFilesResumeCapability”: “[parameters(‘sftp_disableUploadFilesResumeCapability’)]” } } } ], “outputs”: {} } It’s a bit too much, to share the entire Powershell function, but I will explain its workings. The Powershell function reads settings like the subscriptionId and the resource group from a settings.xml file. Next, it’s checked whether the user is already logged on. If not, Login-AzureRmAccount is called without parameters. This opens a window where you can specify username en password. Finally the following statement is run: New-AzureRmResourceGroupDeployment -TemplateFile $templateFilePath -ResourceGroupName $resourceGroupName -TemplateParameterFile $parametersFilePath This command uses the above template file and a parameters file for configuration.