Reference: Deployment template artifact
This article is a reference for a mainTemplate.json artifact in Azure Managed Applications. For more information about authoring deployment template, see Azure Resource Manager templates.
Deployment template
The following JSON shows an example of mainTemplate.json file for Azure Managed Applications:
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "eastus",
"allowedValues": [
"australiaeast",
"eastus",
"westeurope"
],
"metadata": {
"description": "Location for the resources."
}
},
"funcname": {
"type": "string",
"metadata": {
"description": "Name of the Azure Function that hosts the code. Must be globally unique"
},
"defaultValue": ""
},
"storageName": {
"type": "string",
"metadata": {
"description": "Name of the storage account that hosts the function. Must be globally unique. The field can contain only lowercase letters and numbers. Name must be between 3 and 24 characters"
},
"defaultValue": ""
},
"zipFileBlobUri": {
"type": "string",
"defaultValue": "https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.customproviders/custom-rp-with-function/artifacts/functionzip/functionpackage.zip",
"metadata": {
"description": "The Uri to the uploaded function zip file"
}
}
},
"variables": {
"customrpApiversion": "2018-09-01-preview",
"customProviderName": "public",
"serverFarmName": "functionPlan"
},
"resources": [
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2016-09-01",
"name": "[variables('serverFarmName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Y1",
"tier": "Dynamic",
"size": "Y1",
"family": "Y",
"capacity": 0
},
"kind": "functionapp",
"properties": {
"name": "[variables('serverFarmName')]",
"perSiteScaling": false,
"reserved": false,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0
}
},
{
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"name": "[parameters('funcname')]",
"apiVersion": "2018-02-01",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageName'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]"
],
"identity": {
"type": "SystemAssigned"
},
"properties": {
"name": "[parameters('funcname')]",
"siteConfig": {
"appSettings": [
{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "AzureWebJobsSecretStorageType",
"value": "Files"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[concat(toLower(parameters('funcname')), 'b86e')]"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "6.5.0"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "[parameters('zipFileBlobUri')]"
}
]
},
"clientAffinityEnabled": false,
"reserved": false,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('storageName')]",
"apiVersion": "2018-02-01",
"kind": "StorageV2",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_LRS"
}
},
{
"apiVersion": "[variables('customrpApiversion')]",
"type": "Microsoft.CustomProviders/resourceProviders",
"name": "[variables('customProviderName')]",
"location": "[parameters('location')]",
"properties": {
"actions": [
{
"name": "ping",
"routingType": "Proxy",
"endpoint": "[listSecrets(resourceId('Microsoft.Web/sites/functions', parameters('funcname'), 'HttpTrigger1'), '2018-02-01').trigger_url]"
},
{
"name": "users/contextAction",
"routingType": "Proxy",
"endpoint": "[listSecrets(resourceId('Microsoft.Web/sites/functions', parameters('funcname'), 'HttpTrigger1'), '2018-02-01').trigger_url]"
}
],
"resourceTypes": [
{
"name": "users",
"routingType": "Proxy,Cache",
"endpoint": "[listSecrets(resourceId('Microsoft.Web/sites/functions', parameters('funcname'), 'HttpTrigger1'), '2018-02-01').trigger_url]"
}
]
},
"dependsOn": [
"[concat('Microsoft.Web/sites/',parameters('funcname'))]"
]
}
],
"outputs": {}
}
Next steps
Pripomienky
https://aka.ms/ContentUserFeedback.
Pripravujeme: V priebehu roka 2024 postupne zrušíme službu Problémy v službe GitHub ako mechanizmus pripomienok týkajúcich sa obsahu a nahradíme ju novým systémom pripomienok. Ďalšie informácie nájdete na stránke:Odoslať a zobraziť pripomienky pre