tests/functional/Microsoft.Logic/workflows/deploy/deploy.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountName": {
            "type": "string",
            "defaultValue": "[concat('azops', uniqueString(resourceGroup().id))]"
        },
        "storageAccountSku": {
            "type": "string"
        },
        "storageAccountKind": {
            "type": "string"
        },
        "storageAccountContainerName": {
            "type": "string"
        },
        "storageConnectionName": {
            "type": "string",
            "defaultValue": "[concat('storageconnection', uniqueString(resourceGroup().id))]"
        },
        "logicAppName": {
            "type": "string",
            "defaultValue": "[concat('logicapp', uniqueString(resourceGroup().id))]"
        },
        "logicAppPollingIntervalInMinutes": {
            "type": "int",
            "defaultValue": 30
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]"
        },
        "azureMgmtUri": {
            "type": "string"
        }
    },
    "variables": {
        "storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
    },
    "resources": [
        {
            "type": "Microsoft.Web/connections",
            "apiVersion": "2018-07-01-preview",
            "name": "[parameters('storageConnectionName')]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
            ],
            "properties": {
                "api": {
                    "id": "[subscriptionResourceId('Microsoft.Web/locations/managedApis', parameters('location'), 'azureblob')]"
                },
                "parameterValues": {
                    "accountName": "[parameters('storageAccountName')]",
                    "accessKey": "[listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value]"
                },
                "testLinks": [
                    {
                        "requestUri": "[uri(parameters('azureMgmtUri'), concat('subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Web/connections/', parameters('storageConnectionName'), '/extensions/proxy/testconnection?api-version=2018-07-01-preview'))]",
                        "method": "get"
                    }
                ]
            }
        },
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2019-04-01",
            "name": "[parameters('storageAccountName')]",
            "location": "[parameters('location')]",
            "sku": {
                "name": "[parameters('storageAccountSku')]"
            },
            "kind": "[parameters('storageAccountKind')]",
            "properties": {
                "accessTier": "Hot",
                "supportsHttpsTrafficOnly": true
            }
        },
        {
            "type": "Microsoft.Logic/workflows",
            "apiVersion": "2019-05-01",
            "name": "[parameters('logicAppName')]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[resourceId('Microsoft.Web/connections', parameters('storageConnectionName'))]"
            ],
            "properties": {
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {
                        "$connections": {
                            "defaultValue": {},
                            "type": "Object"
                        }
                    },
                    "triggers": {
                        "When_a_blob_is_added_or_modified_(properties_only)": {
                            "recurrence": {
                                "frequency": "Minute",
                                "interval": "[parameters('logicAppPollingIntervalInMinutes')]"
                            },
                            "splitOn": "@triggerBody()",
                            "metadata": {
                                "JTJmbXktY29udGFpbmVy": "[concat('/', parameters('storageAccountContainerName'))]"
                            },
                            "type": "ApiConnection",
                            "inputs": {
                                "host": {
                                    "connection": {
                                        "name": "@parameters('$connections')['azureblob']['connectionId']"
                                    }
                                },
                                "method": "get",
                                "path": "/datasets/default/triggers/batch/onupdatedfile",
                                "queries": {
                                    "folderId": "JTJmbXktY29udGFpbmVy",
                                    "maxFileCount": 10
                                }
                            }
                        }
                    },
                    "actions": {
                        "Process_blobs": {
                            "type": "Scope"
                        }
                    }
                },
                "parameters": {
                    "$connections": {
                        "value": {
                            "azureblob": {
                                "connectionId": "[resourceId('Microsoft.Web/connections', parameters('storageConnectionName'))]",
                                "connectionName": "azureblob",
                                "id": "[subscriptionResourceId('Microsoft.Web/locations/managedApis', parameters('location'), 'azureblob')]"
                            }
                        }
                    }
                },
                "state": "Enabled"
            }
        }
    ]
}