Created
January 16, 2017 14:11
-
-
Save cmatskas/bedfc1c2a6b72d62e46b40d0b773f111 to your computer and use it in GitHub Desktop.
Azure Function ARM Deployment code Inline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"appName": { | |
"type": "string", | |
"metadata": { | |
"description": "The name of the function app that you wish to create." | |
} | |
}, | |
"storageAccountType": { | |
"type": "string", | |
"defaultValue": "Standard_LRS", | |
"allowedValues": [ | |
"Standard_LRS", | |
"Standard_GRS", | |
"Standard_ZRS", | |
"Premium_LRS" | |
], | |
"metadata": { | |
"description": "Storage Account type" | |
} | |
} | |
}, | |
"variables": { | |
"functionAppName": "[parameters('appName')]", | |
"hostingPlanName": "[parameters('appName')]", | |
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'azfunctions')]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[variables('storageAccountName')]", | |
"apiVersion": "2015-06-15", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"accountType": "[parameters('storageAccountType')]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Web/serverfarms", | |
"apiVersion": "2015-04-01", | |
"name": "[variables('hostingPlanName')]", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"name": "[variables('hostingPlanName')]", | |
"computeMode": "Dynamic", | |
"sku": "Dynamic" | |
} | |
}, | |
{ | |
"apiVersion": "2015-08-01", | |
"type": "Microsoft.Web/sites", | |
"name": "[variables('functionAppName')]", | |
"location": "[resourceGroup().location]", | |
"kind": "functionapp", | |
"properties": { | |
"name": "[variables('functionAppName')]", | |
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" | |
}, | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", | |
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" | |
], | |
"resources": [ | |
{ | |
"apiVersion": "2016-03-01", | |
"name": "appsettings", | |
"type": "config", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]", | |
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" | |
], | |
"properties": { | |
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]", | |
"AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]", | |
"FUNCTIONS_EXTENSION_VERSION": "latest" | |
} | |
}, | |
{ | |
"apiVersion": "2015-08-01", | |
"name": "TestFunctionCM", | |
"type": "functions", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]" | |
], | |
"properties": { | |
"config": { | |
"bindings": [ | |
{ | |
"authLevel": "anonymous", | |
"name": "req", | |
"type": "httpTrigger", | |
"direction": "in" | |
}, | |
{ | |
"name": "res", | |
"type": "http", | |
"direction": "out" | |
} | |
] | |
}, | |
"files": { | |
"run.csx": "using System.Net;\r\n\r\n public static HttpResponseMessage Run(HttpRequestMessage req, TraceWriter log)\r\n\r\n {\r\n\r\n return req.CreateResponse(HttpStatusCode.OK, \"Hello from MyFunction\");\r\n\r\n }" | |
} | |
} | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment