Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
128 lines (128 sloc) 5.67 KB
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "String",
"metadata": {
"description": "Name of storage account"
}
},
"functionAppName": {
"type": "String",
"metadata": {
"description": "Name of function app"
}
}
},
"variables": {
"Plan Name": "consumption-plan",
"Insights Mame": "my-insights"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[parameters('storageAccountName')]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard_LRS"
},
"properties": {
"supportsHttpsTrafficOnly": true
}
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2019-08-01",
"name": "[variables('Plan Name')]",
"location": "[resourceGroup().location]",
"dependsOn": [
],
"sku": {
"Tier": "Dynamic",
"Name": "Y1"
},
"properties": {
}
},
{
"type": "microsoft.insights/components",
"apiVersion": "2015-05-01",
"name": "[variables('Insights Mame')]",
"location": "[resourceGroup().location]",
"properties": {
}
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2019-08-01",
"name": "[parameters('functionAppName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('microsoft.insights/components', variables('Insights Mame'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('Plan Name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"kind": "functionapp",
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('microsoft.insights/components', variables('Insights Mame')), '2015-05-01').InstrumentationKey]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value,';EndpointSuffix=','core.windows.net')]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value,';EndpointSuffix=','core.windows.net')]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[concat(toLower(parameters('functionAppName')), 'abcxyz')]"
}
]
},
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('Plan Name'))]",
"clientAffinityEnabled": true
},
"resources": [
{
"type": "functions",
"apiVersion": "2019-08-01",
"name": "recurrent-function",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('functionAppName'))]"
],
"properties": {
"config": {
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */10 * * * *"
}
]
},
"files": {
"run.csx": "using System;\r\n\r\npublic static void Run(TimerInfo myTimer, ILogger log)\r\n{\r\n var isSuccess = (new Random().NextDouble()) < .5;\r\n\r\n log.LogInformation($\"C# Timer trigger function executed at: {DateTime.Now}\");\r\n\r\n if(isSuccess)\r\n {\r\n log.LogInformation($\"Success\");\r\n }\r\n else\r\n {\r\n log.LogInformation($\"Failure\");\r\n\r\n throw new ApplicationException(\"Failure\");\r\n }\r\n}"
},
"isDisabled": false
}
}
]
}
]
}
You can’t perform that action at this time.