Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "functionName": {
- "type": "string"
- },
- "keyVaultName": {
- "type": "string"
- },
- "appInsightsName": {
- "type": "string"
- },
- "storageAccName": {
- "type": "string"
- },
- "sqlAdministratorLogin": {
- "type": "string"
- },
- "sqlAdministratorPassword": {
- "type": "string"
- },
- "sqlServerName": {
- "type": "string"
- },
- "databaseName": {
- "type": "string"
- },
- "userId": {
- "type": "string"
- },
- "namingPrefix": {
- "type": "string"
- },
- "resourceGroupLocation": {
- "type": "string"
- },
- "appSettings": {
- "type": "object"
- }
- },
- "variables": {
- "planName": "[replace(concat(parameters('resourceGroupLocation'), 'Plan'),' ','')]",
- "functionName": "[concat(parameters('namingPrefix'), '-', parameters('functionName'))]",
- "functionStagingName": "staging", //function name automatically added to url
- "keyVaultName": "[concat(parameters('namingPrefix'), '-', parameters('keyVaultName'))]",
- "appInsightsName": "[concat(parameters('namingPrefix'), '-', parameters('appInsightsName'))]",
- "storageAccName": "[toLower(concat(parameters('namingPrefix'), parameters('storageAccName')))]",
- "sqlServerName": "[concat(parameters('namingPrefix'), '-', parameters('sqlServerName'))]",
- "databaseName": "[concat(parameters('namingPrefix'), '-', parameters('databaseName'))]",
- "staticAppSettings": {
- "WEBSITE_NODE_DEFAULT_VERSION": "10.14.1",
- "WEBSITE_RUN_FROM_PACKAGE": "1",
- "FUNCTIONS_EXTENSION_VERSION": "~2",
- "FUNCTIONS_WORKER_RUNTIME": "dotnet"
- },
- "completeAppSettings": "[union(variables('staticAppSettings'), parameters('appSettings'))]"
- },
- "resources": [
- {
- "type": "microsoft.insights/components",
- "apiVersion": "2015-05-01",
- "name": "[variables('appInsightsName')]",
- "location": "[ResourceGroup().location]",
- "kind": "web",
- "properties": {
- "Application_Type": "web",
- "Request_Source": "IbizaWebAppExtensionCreate"
- }
- },
- {
- "type": "Microsoft.KeyVault/vaults",
- "apiVersion": "2016-10-01",
- "name": "[variables('keyVaultName')]",
- "location": "[ResourceGroup().location]",
- "properties": {
- "sku": {
- "family": "A",
- "name": "Standard"
- },
- "tenantId": "[subscription().tenantId]",
- "accessPolicies": [
- {
- "tenantId": "[subscription().tenantId]",
- "objectId": "[parameters('userId')]",
- "permissions": {
- "keys": [
- "Get",
- "List",
- "Update",
- "Create",
- "Import",
- "Delete",
- "Recover",
- "Backup",
- "Restore"
- ],
- "secrets": [
- "Get",
- "List",
- "Set",
- "Delete",
- "Recover",
- "Backup",
- "Restore"
- ],
- "certificates": [
- "Get",
- "List",
- "Update",
- "Create",
- "Import",
- "Delete",
- "Recover",
- "Backup",
- "Restore",
- "ManageContacts",
- "ManageIssuers",
- "GetIssuers",
- "ListIssuers",
- "SetIssuers",
- "DeleteIssuers"
- ]
- }
- }
- ],
- "enabledForDeployment": false,
- "enabledForDiskEncryption": false,
- "enabledForTemplateDeployment": false
- }
- },
- {
- "type": "Microsoft.KeyVault/vaults/accessPolicies",
- "name": "[concat(variables('keyVaultName'),'/add')]",
- "apiVersion": "2018-02-14",
- "dependsOn": [
- "[resourceId('Microsoft.Web/sites', variables('functionName'))]",
- "[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]"
- ],
- "properties": {
- "accessPolicies": [
- {
- "tenantId": "[subscription().tenantId]",
- "objectId": "[reference(concat(resourceId('Microsoft.Web/sites', variables('functionName')), '/providers/Microsoft.ManagedIdentity/Identities/default'), '2015-08-31-PREVIEW').principalId]",
- "permissions": {
- "keys": [
- ],
- "secrets": [
- "Get",
- "Set",
- "Delete"
- ],
- "certificates": [
- ]
- }
- }
- ]
- }
- },
- {
- "type": "Microsoft.Storage/storageAccounts",
- "apiVersion": "2019-04-01",
- "name": "[variables('storageAccName')]",
- "location": "[ResourceGroup().location]",
- "sku": {
- "name": "Standard_LRS",
- "tier": "Standard"
- },
- "kind": "Storage",
- "properties": {
- "networkAcls": {
- "bypass": "AzureServices",
- "virtualNetworkRules": [],
- "ipRules": [],
- "defaultAction": "Allow"
- },
- "supportsHttpsTrafficOnly": true,
- "encryption": {
- "services": {
- "file": {
- "enabled": true
- },
- "blob": {
- "enabled": true
- }
- },
- "keySource": "Microsoft.Storage"
- }
- }
- },
- {
- "type": "Microsoft.Web/serverfarms",
- "apiVersion": "2016-09-01",
- "name": "[variables('planName')]",
- "location": "[ResourceGroup().location]",
- "sku": {
- "name": "Y1",
- "tier": "Dynamic",
- "size": "Y1",
- "family": "Y",
- "capacity": 0
- },
- "kind": "functionapp",
- "properties": {
- "name": "[variables('planName')]",
- "computeMode": "Dynamic",
- "perSiteScaling": false,
- "reserved": false,
- "targetWorkerCount": 0,
- "targetWorkerSizeId": 0
- }
- },
- {
- "type": "Microsoft.KeyVault/vaults/secrets",
- "apiVersion": "2016-10-01",
- "name": "[concat(variables('keyVaultName'), '/ExponeaPrivate')]",
- "location": "northeurope",
- "dependsOn": [
- "[variables('keyVaultName')]"
- ],
- "properties": {
- "value": "sample"
- }
- },
- {
- "type": "Microsoft.KeyVault/vaults/secrets",
- "apiVersion": "2016-10-01",
- "name": "[concat(variables('keyVaultName'), '/OTAccessToken')]",
- "location": "northeurope",
- "dependsOn": [
- "[variables('keyVaultName')]"
- ],
- "properties": {
- "value": "sample"
- }
- },
- {
- "type": "Microsoft.Sql/servers",
- "apiVersion": "2015-05-01-preview",
- "name": "[variables('sqlServerName')]",
- "location": "[ResourceGroup().location]",
- "properties": {
- "administratorLogin": "[parameters('sqlAdministratorLogin')]",
- "administratorLoginPassword": "[parameters('sqlAdministratorPassword')]",
- "version": "12.0"
- },
- "resources": [
- {
- "apiVersion": "2017-10-01-preview",
- "dependsOn": [
- "[concat('Microsoft.Sql/servers/', variables('sqlServerName'))]"
- ],
- "location": "[ResourceGroup().location]",
- "name": "[variables('databaseName')]",
- "properties": {
- "collation": "SQL_Latin1_General_CP1_CI_AS",
- "maxSizeBytes": 104857600,
- "sampleName": "",
- "zoneRedundant": false,
- "licenseType": "",
- "readScale": "Disabled",
- "readReplicaCount": 0,
- "minCapacity": "",
- "autoPauseDelay": ""
- },
- "sku": {
- "name": "Basic",
- "tier": "Basic"
- },
- "type": "databases"
- },
- {
- "apiVersion": "2014-04-01-preview",
- "dependsOn": [
- "[concat('Microsoft.Sql/servers/', variables('sqlServerName'))]"
- ],
- "location": "[ResourceGroup().location]",
- "name": "AllowAllWindowsAzureIps",
- "properties": {
- "endIpAddress": "0.0.0.0",
- "startIpAddress": "0.0.0.0"
- },
- "type": "firewallrules"
- }
- ]
- },
- {
- "type": "Microsoft.Web/sites",
- "apiVersion": "2016-08-01",
- "name": "[variables('functionName')]",
- "location": "[ResourceGroup().location]",
- "dependsOn": [
- "[variables('planName')]",
- "[variables('appInsightsName')]",
- "[variables('storageAccName')]",
- "[variables('keyVaultName')]",
- "[variables('databaseName')]"
- ],
- "kind": "functionapp",
- "identity": {
- "type": "SystemAssigned"
- },
- "properties": {
- "serverFarmId": "[variables('planName')]",
- "enabled": true,
- "reserved": false
- },
- "resources": [
- {
- "apiVersion": "2015-08-01",
- "name": "connectionstrings",
- "type": "config",
- "dependsOn": [
- "[variables('functionName')]",
- "[variables('databaseName')]"
- ],
- "properties": {
- }
- },
- {
- "apiVersion": "2015-08-01",
- "name": "appsettings",
- "type": "config",
- "dependsOn": [
- "[variables('functionName')]",
- "[variables('appInsightsName')]",
- "[variables('storageAccName')]",
- "[variables('keyVaultName')]"
- ],
- "properties": "[union(variables('completeAppSettings'),json(concat('{ AzureWebJobsStorage:\"', concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccName')), '2019-04-01').keys[0].value), '\", WEBSITE_CONTENTAZUREFILECONNECTIONSTRING:\"',\tconcat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccName')), '2019-04-01').keys[0].value), '\", WEBSITE_CONTENTSHARE:\"', variables('functionName'), '\", APPINSIGHTS_INSTRUMENTATIONKEY:\"', reference(concat('microsoft.insights/components/', variables('appInsightsName'))).InstrumentationKey, '\", KeyVaultUri:\"', reference(concat('Microsoft.KeyVault/vaults/', variables('keyVaultName'))).vaultUri, '\"}')))]"
- },
- {
- "type": "slots",
- "apiVersion": "2016-08-01",
- "name": "[variables('functionStagingName')]",
- "location": "[ResourceGroup().location]",
- "dependsOn": [
- "[variables('functionName')]",
- "[variables('keyVaultName')]"
- ],
- "kind": "functionapp",
- "properties": {
- "enabled": false,
- "serverFarmId": "[variables('planName')]"
- }
- }
- ]
- }
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment