Вы можете пропустить serverFarmId
в вашем шаблоне.Попробуйте шаблон ниже, он не будет создавать отдельный план обслуживания приложения, в моем примере он присоединяет Function App к существующему плану обслуживания приложения joyplan
и учетной записи хранения joystoragev1
, создает представление приложения joytestfuninsight
и присоединяется к нему..
Образец:
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "String"
},
"storageName": {
"type": "String"
},
"hostingPlanName": {
"type": "String"
},
"location": {
"type": "String"
},
"serverFarmResourceGroup": {
"type": "String"
},
"subscriptionId": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"name": "[parameters('name')]",
"apiVersion": "2016-03-01",
"location": "[parameters('location')]",
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('b83c1ed3-c5b6-44fb-b5ba-2b83a074c23f','joywebapp','Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "8.11.1"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference('microsoft.insights/components/joytestfuninsight', '2015-05-01').InstrumentationKey]"
}
],
"alwaysOn": true
},
"name": "[parameters('name')]",
"clientAffinityEnabled": false,
"serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
},
"dependsOn": [
"microsoft.insights/components/joytestfuninsight"
]
},
{
"type": "microsoft.insights/components",
"name": "joytestfuninsight",
"apiVersion": "2015-05-01",
"location": "eastus",
"properties": {
"ApplicationId": "[parameters('name')]",
"Request_Source": "IbizaWebAppExtensionCreate"
}
}
]
}
Мои тестовые параметры:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "joytestfun"
},
"storageName": {
"value": "joystoragev1"
},
"hostingPlanName": {
"value": "joyplan"
},
"location": {
"value": "Central US"
},
"serverFarmResourceGroup": {
"value": "joywebapp"
},
"subscriptionId": {
"value": "xxxxxxxxxxxxxxxxxxxx"
}
}
}
Обновление :
Если вы хотите создатьФункциональное приложение с планом потребления, вы можете обратиться к шаблону ниже.
Образец:
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "String"
},
"storageName": {
"type": "String"
},
"location": {
"type": "String"
},
"subscriptionId": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"name": "[parameters('name')]",
"apiVersion": "2016-03-01",
"location": "Central US",
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('b83c1ed3-xxxxxxxxxxx-2b83a074c23f','joywebapp','Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('b83c1ed3-xxxxxxxxxxx-2b83a074c23f','joywebapp','Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[concat(toLower(parameters('name')), 'b32d')]"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "8.11.1"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference('microsoft.insights/components/joytest11insight', '2015-05-01').InstrumentationKey]"
}
]
},
"name": "[parameters('name')]",
"clientAffinityEnabled": false,
"reserved": false
},
"dependsOn": [
"microsoft.insights/components/joytest11insight"
]
},
{
"type": "microsoft.insights/components",
"name": "joytest11insight",
"apiVersion": "2015-05-01",
"location": "eastus",
"properties": {
"ApplicationId": "[parameters('name')]",
"Request_Source": "IbizaWebAppExtensionCreate"
}
}
]
}
Мои параметры теста:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "joytest11"
},
"storageName": {
"value": "joystoragev1"
},
"location": {
"value": "central us"
},
"subscriptionId": {
"value": "b83c1ed3-xxxxxxxxxxx-2b83a074c23f"
}
}
}