Skip to content

Instantly share code, notes, and snippets.

@shawnweisfeld
Created May 1, 2019 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawnweisfeld/c783739920dee935f126f0e8662e4af5 to your computer and use it in GitHub Desktop.
Save shawnweisfeld/c783739920dee935f126f0e8662e4af5 to your computer and use it in GitHub Desktop.
{
"$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": "[resourceGroup().location]",
"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"
],
"metadata": {
"description": "Location of the Logic App."
}
},
"office365_1_Connection_Name": {
"type": "string",
"defaultValue": "office365"
},
"office365_1_Connection_DisplayName": {
"type": "string",
"defaultValue": "EmailConnection"
},
"office365_1_Connection_FromAddress": {
"type": "string"
},
"sftp_1_Connection_Name": {
"type": "string",
"defaultValue": "sftp"
},
"sftp_1_Connection_DisplayName": {
"type": "string",
"defaultValue": "MySFTPConnection"
},
"sftp_1_hostName": {
"type": "string",
"metadata": {
"description": "Host Server Address"
}
},
"sftp_1_userName": {
"type": "string",
"metadata": {
"description": "User Name"
}
},
"sftp_1_password": {
"type": "securestring",
"metadata": {
"description": "Password"
}
},
"sftp_1_folder": {
"type": "string",
"metadata": {
"description": "SFTP Folder"
}
},
"sftp_1_sshPrivateKey": {
"type": "securestring",
"metadata": {
"description": "SSH private key (the content of the file should be provided entirely as is, in the multiline format)"
},
"defaultValue": ""
},
"sftp_1_sshPrivateKeyPassphrase": {
"type": "securestring",
"metadata": {
"description": "SSH private key passphrase (if the private key is protected by a passphrase)"
},
"defaultValue": ""
},
"sftp_1_portNumber": {
"type": "int",
"metadata": {
"description": "SFTP Port Number (example: 22)"
},
"defaultValue": ""
},
"sftp_1_giveUpSecurityAndAcceptAnySshHostKey": {
"type": "bool",
"metadata": {
"description": "Disable SSH Host Key Validation? (True/False)"
},
"defaultValue": true
},
"sftp_1_sshHostKeyFingerprint": {
"type": "string",
"metadata": {
"description": "SSH Host Key Finger-print"
},
"defaultValue": ""
},
"sftp_1_disableUploadFilesResumeCapability": {
"type": "bool",
"metadata": {
"description": "Disable Resume Capability? (True/False)"
},
"defaultValue": false
}
},
"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": {
"Send_an_email": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"body": {
"To": "[parameters('office365_1_Connection_FromAddress')]",
"Subject": "Found New File",
"Body": "@base64ToString(triggerOutputs()['headers']['x-ms-file-name-encoded'])"
},
"path": "/Mail"
},
"runAfter": {}
}
},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_file_is_added_or_modified": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sftp']['connectionId']"
}
},
"method": "get",
"path": "/datasets/default/triggers/onupdatedfile",
"queries": {
"folderId": "[parameters('sftp_1_folder')]",
"queryParametersSingleEncoded": true,
"includeFileContent": true,
"inferContentType": true
}
},
"recurrence": {
"frequency": "Minute",
"interval": 1
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"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')]"
},
"sftp": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'sftp')]",
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('sftp_1_Connection_Name'))]",
"connectionName": "[parameters('sftp_1_Connection_Name')]"
}
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('office365_1_Connection_Name'))]",
"[resourceId('Microsoft.Web/connections', parameters('sftp_1_Connection_Name'))]"
]
},
{
"type": "MICROSOFT.WEB/CONNECTIONS",
"apiVersion": "2016-06-01",
"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')]"
}
},
{
"type": "MICROSOFT.WEB/CONNECTIONS",
"apiVersion": "2016-06-01",
"name": "[parameters('sftp_1_Connection_Name')]",
"location": "[parameters('logicAppLocation')]",
"properties": {
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'sftp')]"
},
"displayName": "[parameters('sftp_1_Connection_DisplayName')]",
"parameterValues": {
"hostName": "[parameters('sftp_1_hostName')]",
"userName": "[parameters('sftp_1_userName')]",
"password": "[parameters('sftp_1_password')]",
"sshPrivateKey": "[parameters('sftp_1_sshPrivateKey')]",
"sshPrivateKeyPassphrase": "[parameters('sftp_1_sshPrivateKeyPassphrase')]",
"portNumber": "[parameters('sftp_1_portNumber')]",
"giveUpSecurityAndAcceptAnySshHostKey": "[parameters('sftp_1_giveUpSecurityAndAcceptAnySshHostKey')]",
"sshHostKeyFingerprint": "[parameters('sftp_1_sshHostKeyFingerprint')]",
"disableUploadFilesResumeCapability": "[parameters('sftp_1_disableUploadFilesResumeCapability')]"
}
}
}
],
"outputs": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment