Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
azure-functions-host-key/azure-deploy.json
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
161 lines (161 sloc)
7.02 KB
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/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"location": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]", | |
"metadata": { | |
"description": "The region to deploy the resources." | |
} | |
}, | |
"appInsightsRegion": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]", | |
"metadata": { | |
"description": "The region to deploy the Application Insights resource" | |
} | |
} | |
}, | |
"variables": { | |
"baseName": "[uniqueString(resourceGroup().id)]", | |
"appInsightsName": "[concat(variables('baseName'), 'ai')]", | |
"keyVaultName": "[concat('c', variables('baseName'), 'kvt')]", | |
"appServicePlanName": "[concat(variables('baseName'), 'asp')]", | |
"functionAppName": "[concat(variables('baseName'), 'fa')]", | |
"storageAccountName": "[concat(variables('baseName'), 'sa')]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.KeyVault/vaults", | |
"apiVersion": "2019-09-01", | |
"name": "[variables('keyVaultName')]", | |
"location": "[parameters('location')]", | |
"dependsOn":[ | |
"[resourceId('Microsoft.Web/sites',variables('functionAppName'))]" | |
], | |
"properties": { | |
"enabledForDeployment": "true", | |
"enabledForDiskEncryption": "false", | |
"enabledForTemplateDeployment": "false", | |
"enableSoftDelete":"false", | |
"tenantId": "[subscription().tenantId]", | |
"accessPolicies": [ | |
{ | |
"tenantId":"[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2018-02-01', 'Full').identity.tenantId]", | |
"objectId":"[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2018-02-01', 'Full').identity.principalId]", | |
"permissions": { | |
"secrets": [ "get" ] | |
} | |
} | |
], | |
"sku": { | |
"name": "Standard", | |
"family": "A" | |
}, | |
"networkAcls": { | |
"defaultAction": "Allow", | |
"bypass": "AzureServices" | |
} | |
} | |
}, | |
{ | |
"type": "Microsoft.KeyVault/vaults/secrets", | |
"apiVersion": "2019-09-01", | |
"name": "[concat(variables('keyVaultName'), '/', 'functionKey')]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]", | |
"[resourceId('Microsoft.Web/sites',variables('functionAppName'))]" | |
], | |
"properties": { | |
"value": "[listKeys(concat(resourceId('Microsoft.Web/sites', variables('functionAppName')), '/host/default'), '2016-08-01').functionKeys.default]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Insights/components", | |
"apiVersion": "2015-05-01", | |
"name": "[variables('appInsightsName')]", | |
"location": "[parameters('appInsightsRegion')]", | |
"kind": "web", | |
"properties": { | |
"Application_Type": "web" | |
} | |
}, | |
{ | |
"name": "[variables('storageAccountName')]", | |
"type": "Microsoft.Storage/storageAccounts", | |
"apiVersion": "2019-04-01", | |
"sku": { | |
"name": "Standard_LRS" | |
}, | |
"kind": "StorageV2", | |
"location": "[parameters('location')]", | |
"properties": { | |
"accessTier": "Hot" | |
}, | |
"resources": [] | |
}, | |
{ | |
"type": "Microsoft.Web/serverfarms", | |
"apiVersion": "2020-06-01", | |
"name": "[variables('appServicePlanName')]", | |
"location": "[parameters('location')]", | |
"sku": { | |
"name": "Y1", | |
"tier": "Dynamic", | |
"size": "Y1", | |
"family": "Y", | |
"capacity": 0 | |
}, | |
"properties": { | |
"perSiteScaling": false, | |
"maximumElasticWorkerCount": 1, | |
"isSpot": false, | |
"reserved": false, | |
"isXenon": false, | |
"hyperV": false, | |
"targetWorkerCount": 0, | |
"targetWorkerSizeId": 0 | |
}, | |
"kind": "functionapp" | |
}, | |
{ | |
"type": "Microsoft.Web/sites", | |
"apiVersion": "2020-06-01", | |
"name": "[variables('functionAppName')]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]" | |
], | |
"kind": "functionapp", | |
"identity": { | |
"type": "SystemAssigned" | |
}, | |
"properties": { | |
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]", | |
"httpsOnly": true | |
}, | |
"resources": [] | |
}, | |
{ | |
"type": "Microsoft.Web/sites/config", | |
"apiVersion": "2020-06-01", | |
"name": "[concat(variables('functionAppName'), '/appsettings')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]", | |
"[resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'),'functionKey')]" | |
], | |
"properties": { | |
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'), ';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2019-06-01').keys[0].value, ';EndpointSuffix=', environment().suffixes.storage)]", | |
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'), ';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2019-06-01').keys[0].value, ';EndpointSuffix=', environment().suffixes.storage)]", | |
"WEBSITE_CONTENTSHARE": "[variables('functionAppName')]", | |
"FUNCTIONS_EXTENSION_VERSION": "~3", | |
"FUNCTIONS_WORKER_RUNTIME": "dotnet", | |
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', variables('appInsightsName')), '2018-05-01-preview').instrumentationKey]", | |
"WEBSITE_RUN_FROM_PACKAGE": "1", | |
"MyFunctionHostKey":"[concat('@Microsoft.KeyVault(SecretUri=', reference(resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), 'functionKey')).secretUriWithVersion, ')')]" | |
} | |
} | |
] | |
} |