azure-functions - 无法在 Azure Function App 或 Azure Function 中创建应用密钥:遇到来自主机运行时的错误 (InternalServerError)
问题描述
我使用 ARM 模板创建了一个 Azure 函数应用。函数应用具有系统分配的标识。身份具有对密钥保管库中的密钥、机密和证书具有获取/列表权限的访问策略。我还尝试了另外创建/更新权限。但它并没有解决问题。
当我尝试创建功能键时,我在 Web 门户中收到以下错误消息:
Creating host key Failed to create <key name>: Encountered an error (InternalServerError) from host runtime.
这是函数的模板(来自导出模板):
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"function_app_name": {
"defaultValue": "test-fct-app",
"type": "String"
},
"app_service_plan_id": {
"defaultValue": "/subscriptions/<subscription_id>/resourceGroups/<rg-name>/providers/Microsoft.Web/serverfarms/<app-service-plan-name>",
"type": "String"
},
"vnet_id": {
"defaultValue": "/subscriptions/<subscription_id>/resourceGroups/<rg-name>/providers/Microsoft.Network/virtualNetworks/<subnet-name>",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[parameters('function_app_name')]",
"location": "Germany West Central",
"kind": "functionapp",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "[concat(parameters('function_app_name'), '.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "[concat(parameters('function_app_name'), '.scm.azurewebsites.net')]",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[parameters('app_service_plan_id')]",
"reserved": false,
"isXenon": false,
"hyperV": false,
"siteConfig": {},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": false,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"containerSize": 1536,
"dailyMemoryTimeQuota": 0,
"httpsOnly": false,
"redundancyMode": "None"
}
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('function_app_name'), '/web')]",
"location": "Germany West Central",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('function_app_name'))]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php"
],
"netFrameworkVersion": "v4.0",
"phpVersion": "5.6",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "[concat('$', parameters('function_app_name'))]",
"azureStorageAccounts": {},
"scmType": "LocalGit",
"use32BitWorkerProcess": false,
"webSocketsEnabled": false,
"alwaysOn": false,
"javaVersion": "1.8",
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"vnetName": "8059ef61-4a93-4b13-bba1-e2a782a07360_function-subnet",
"cors": {
"allowedOrigins": [
"https://functions.azure.com",
"https://functions-staging.azure.com",
"https://functions-next.azure.com"
],
"supportCredentials": false
},
"localMySqlEnabled": false,
"managedServiceIdentityId": 2290,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
},
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('function_app_name'), '/', parameters('function_app_name'), '.azurewebsites.net')]",
"location": "Germany West Central",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('function_app_name'))]"
],
"properties": {
"siteName": "[parameters('function_app_name')]",
"hostNameType": "Verified"
}
},
{
"type": "Microsoft.Web/sites/virtualNetworkConnections",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('function_app_name'), '/8059ef61-4a93-4b13-bba1-e2a782a07360_function-subnet')]",
"location": "Germany West Central",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('function_app_name'))]"
],
"properties": {
"vnetResourceId": "[concat(parameters('vnet_id'), '/subnets/function-subnet')]",
"isSwift": true
}
}
]
}
解决方案
如果您的函数在启动时失败,Azure 门户中将不会正确显示任何内容。您将无法对此 Azure 函数执行任何操作。
尝试在你的模拟器中运行这个函数,看看你是否遇到任何错误。
推荐阅读
- node.js - 码头工人中的码头工人
- angularjs-ng-click - ng-click 在加载到 div 中的 HTML 中不起作用
- php - 如何从列表元素中的 html 文档调用 php 函数?
- scala - 从 spark udf 记录到驱动程序
- android - 如何在布局边框顶部对齐 FAB
- javascript - 如何将使用指标从 spotfire 发送到谷歌分析
- laravel - 雄辩的缓存结果像 $book->author 吗?
- c# - 将多行脚本从另一个 PowerShell 传递到 PowerShell?
- android - 如何在 Switch/SwitchCompat 按钮中设置宽度和跟踪文本并实现此结果?(附图片和GIF)
- c - .so 文件如何查找符号?