Created
November 1, 2019 03:28
-
-
Save shibayan/5650dd565cb89fd775c9310fd7d0a47f to your computer and use it in GitHub Desktop.
Azure Functions + Run From Package ARM Template sample
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": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"appNamePrefix": { | |
"type": "string", | |
"metadata": { | |
"description": "The name of the function app that you wish to create." | |
} | |
} | |
}, | |
"variables": { | |
"functionAppName": "[concat(parameters('appNamePrefix'), '-', substring(uniquestring(resourceGroup().id, deployment().name), 0, 4))]", | |
"storageAccountName": "[concat(uniquestring(resourceGroup().id, deployment().name), 'azfunctions')]", | |
"storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[variables('storageAccountName')]", | |
"apiVersion": "2019-04-01", | |
"location": "[resourceGroup().location]", | |
"sku": { | |
"name": "Standard_LRS" | |
} | |
}, | |
{ | |
"type": "Microsoft.Web/serverfarms", | |
"name": "[variables('functionAppName')]", | |
"apiVersion": "2019-08-01", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"name": "[variables('functionAppName')]" | |
}, | |
"sku": { | |
"name": "Y1", | |
"tier": "Dynamic", | |
"size": "Y1", | |
"family": "Y" | |
} | |
}, | |
{ | |
"type": "Microsoft.Insights/components", | |
"name": "[variables('functionAppName')]", | |
"apiVersion": "2015-05-01", | |
"location": "[resourceGroup().location]", | |
"tags": { | |
"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('functionAppName'))]": "Resource" | |
}, | |
"properties": { | |
"applicationId": "[variables('functionAppName')]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Web/sites", | |
"name": "[variables('functionAppName')]", | |
"apiVersion": "2019-08-01", | |
"location": "[resourceGroup().location]", | |
"kind": "functionapp", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/serverfarms', variables('functionAppName'))]", | |
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]", | |
"[resourceId('Microsoft.Insights/components', variables('functionAppName'))]" | |
], | |
"properties": { | |
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('functionAppName'))]", | |
"siteConfig": { | |
"appSettings": [ | |
{ | |
"name": "APPINSIGHTS_INSTRUMENTATIONKEY", | |
"value": "[reference(resourceId('Microsoft.Insights/components', variables('functionAppName')), '2015-05-01').InstrumentationKey]" | |
}, | |
{ | |
"name": "AzureWebJobsStorage", | |
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value)]" | |
}, | |
{ | |
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", | |
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value)]" | |
}, | |
{ | |
"name": "WEBSITE_CONTENTSHARE", | |
"value": "[toLower(variables('functionAppName'))]" | |
}, | |
{ | |
"name": "WEBSITE_RUN_FROM_PACKAGE", | |
"value": "1" | |
}, | |
{ | |
"name": "FUNCTIONS_EXTENSION_VERSION", | |
"value": "~2" | |
}, | |
{ | |
"name": "FUNCTIONS_WORKER_RUNTIME", | |
"value": "dotnet" | |
} | |
], | |
"clientAffinityEnabled": false | |
} | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2019-08-01", | |
"type": "extensions", | |
"name": "zipdeploy", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]" | |
], | |
"properties": { | |
"packageUri": "https://shibayan.blob.core.windows.net/FunctionApp.zip" | |
} | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment