azure - 通过 ARM 部署时无法在 QnA Maker 中创建 KB(未找到端点 key )

标签 azure azure-devops azure-resource-manager azure-qna-maker

我遇到一个问题,无法在 QnA Maker 中为通过 ARM 模板/DevOps 部署的服务创建知识库。这里和 Github 上有很多问题,但主要建议(在同一区域创建所有资源,不要在应用程序服务计划中添加任何其他内容,删除并重新部署)对我来说不起作用。如前所述,资源已使用相同名称多次创建和删除,所以我不知道这是否是问题的一部分。资源创建得很好(认知服务、应用服务、应用服务计划、azure 搜索和应用洞察),全部都在 WestUS 中,但我无法通过 API 或直接在 qnamaker.ai 创建知识库。在这两种情况下我都会收到错误消息:

未找到端点 key

我可以通过 Azure CLI 获取 key ,而且它们显示在门户中,所以这不是问题。这可能是发布新知识库后生成/显示的授权端点 key 的问题,但由于我无法创建或发布 key ,因此我找不到此 key 。不确定这是否是错误消息所指的关键。

这是我用来设置资源的 ARM 模板。

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "sites_etn_qnamaker_name": {
            "defaultValue": "etn-qnamaker",
            "type": "string"
        },
        "serverfarms_etn_qnamaker_name": {
            "defaultValue": "etn-qnamaker",
            "type": "string"
        },
        "components_etn_qnamaker_ai_name": {
            "defaultValue": "etn-qnamaker-ai",
            "type": "string"
        },
        "accounts_etn_qnamaker_name": {
            "defaultValue": "etn-qnamaker",
            "type": "string"
        },
        "searchServices_etnqnamaker_azsearch_name": {
            "defaultValue": "etnqnamaker-azsearch",
            "type": "string"
        },
        "smartdetectoralertrules_failure_anomalies___etn_qnamaker_ai_name": {
            "defaultValue": "failure anomalies - etn-qnamaker-ai",
            "type": "string"
        },
        "actiongroups_application_20insights_20smart_20detection_externalid": {
            "defaultValue": "/subscriptions/REDACTED/resourceGroups/avcnc-chatbot-rg/providers/microsoft.insights/actiongroups/application%20insights%20smart%20detection",
            "type": "string"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.CognitiveServices/accounts",
            "apiVersion": "2017-04-18",
            "name": "[parameters('accounts_etn_qnamaker_name')]",
            "location": "westus",
            "sku": {
                "name": "S0"
            },
            "kind": "QnAMaker",
            "properties": {
                "apiProperties": {
                    "qnaRuntimeEndpoint": "[concat('https://', parameters('accounts_etn_qnamaker_name'), '.azurewebsites.net')]"
                },
                "customSubDomainName": "[parameters('accounts_etn_qnamaker_name')]"
            }
        },
        {
            "type": "Microsoft.Insights/components",
            "apiVersion": "2015-05-01",
            "name": "[parameters('components_etn_qnamaker_ai_name')]",
            "location": "westus",
            "tags": {
                "hidden-link:/subscriptions/REDACTED/resourceGroups/ENTP-Chatbot-rg/providers/Microsoft.Web/sites/etn-qnamaker": "Resource"
            },
            "kind": "web",
            "properties": {
                "Application_Type": "web"
            }
        },
        {
            "type": "Microsoft.Search/searchServices",
            "apiVersion": "2015-08-19",
            "name": "[parameters('searchServices_etnqnamaker_azsearch_name')]",
            "location": "West US",
            "sku": {
                "name": "basic"
            },
            "properties": {
                "replicaCount": 1,
                "partitionCount": 1,
                "hostingMode": "default"
            }
        },
        {
            "type": "Microsoft.Web/serverfarms",
            "apiVersion": "2018-02-01",
            "name": "[parameters('serverfarms_etn_qnamaker_name')]",
            "location": "West US",
            "sku": {
                "name": "S1",
                "tier": "Standard",
                "size": "S1",
                "family": "S",
                "capacity": 1
            },
            "kind": "app",
            "properties": {
                "perSiteScaling": false,
                "maximumElasticWorkerCount": 1,
                "isSpot": false,
                "reserved": false,
                "isXenon": false,
                "hyperV": false,
                "targetWorkerCount": 0,
                "targetWorkerSizeId": 0
            }
        },
        {
            "type": "microsoft.alertsmanagement/smartdetectoralertrules",
            "apiVersion": "2019-06-01",
            "name": "[parameters('smartdetectoralertrules_failure_anomalies___etn_qnamaker_ai_name')]",
            "location": "global",
            "dependsOn": [
                "[resourceId('microsoft.insights/components', parameters('components_etn_qnamaker_ai_name'))]"
            ],
            "properties": {
                "description": "Failure Anomalies notifies you of an unusual rise in the rate of failed HTTP requests or dependency calls.",
                "state": "Enabled",
                "severity": "Sev3",
                "frequency": "PT1M",
                "detector": {
                    "id": "FailureAnomaliesDetector",
                    "name": "Failure Anomalies",
                    "description": "Detects if your application experiences an abnormal rise in the rate of HTTP requests or dependency calls that are reported as failed. The anomaly detection uses machine learning algorithms and occurs in near real time, therefore there's no need to define a frequency for this signal.<br/></br/>To help you triage and diagnose the problem, an analysis of the characteristics of the failures and related telemetry is provided with the detection. This feature works for any app, hosted in the cloud or on your own servers, that generates request or dependency telemetry - for example, if you have a worker role that calls <a class=\"ext-smartDetecor-link\" href=\\\"https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackrequest\\\" target=\\\"_blank\\\">TrackRequest()</a> or <a class=\"ext-smartDetecor-link\" href=\\\"https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackdependency\\\" target=\\\"_blank\\\">TrackDependency()</a>.",
                    "supportedResourceTypes": [
                        "ApplicationInsights"
                    ],
                    "imagePaths": [
                        "https://globalsmartdetectors.blob.core.windows.net/detectors/FailureAnomaliesDetector/v0.18/FailureAnomaly.png"
                    ]
                },
                "scope": [
                    "[resourceId('microsoft.insights/components', parameters('components_etn_qnamaker_ai_name'))]"
                ],
                "actionGroups": {
                    "groupIds": [
                        "[parameters('actiongroups_application_20insights_20smart_20detection_externalid')]"
                    ]
                }
            }
        },
        {
            "type": "Microsoft.Web/sites",
            "apiVersion": "2018-11-01",
            "name": "[parameters('sites_etn_qnamaker_name')]",
            "location": "West US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_etn_qnamaker_name'))]"
            ],
            "tags": {
                "hidden-related:/subscriptions/REDACTED/resourcegroups/ENTP-Chatbot-rg/providers/Microsoft.Web/serverfarms/etn-qnamaker": "empty"
            },
            "kind": "app",
            "properties": {
                "enabled": true,
                "hostNameSslStates": [
                    {
                        "name": "[concat(parameters('sites_etn_qnamaker_name'), '.azurewebsites.net')]",
                        "sslState": "Disabled",
                        "hostType": "Standard"
                    },
                    {
                        "name": "[concat(parameters('sites_etn_qnamaker_name'), '.scm.azurewebsites.net')]",
                        "sslState": "Disabled",
                        "hostType": "Repository"
                    }
                ],
                "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_etn_qnamaker_name'))]",
                "reserved": false,
                "isXenon": false,
                "hyperV": false,
                "scmSiteAlsoStopped": false,
                "clientAffinityEnabled": true,
                "clientCertEnabled": false,
                "hostNamesDisabled": false,
                "containerSize": 0,
                "dailyMemoryTimeQuota": 0,
                "httpsOnly": false,
                "redundancyMode": "None"
            }
        },
        {
            "type": "Microsoft.Web/sites/config",
            "apiVersion": "2018-11-01",
            "name": "[concat(parameters('sites_etn_qnamaker_name'), '/web')]",
            "location": "West US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_etn_qnamaker_name'))]"
            ],
            "tags": {
                "hidden-related:/subscriptions/REDACTED/resourcegroups/ENTP-Chatbot-rg/providers/Microsoft.Web/serverfarms/etn-qnamaker": "empty"
            },
            "properties": {
                "numberOfWorkers": 1,
                "defaultDocuments": [
                    "Default.htm",
                    "Default.html",
                    "Default.asp",
                    "index.htm",
                    "index.html",
                    "iisstart.htm",
                    "default.aspx",
                    "index.php",
                    "hostingstart.html"
                ],
                "netFrameworkVersion": "v4.0",
                "phpVersion": "5.6",
                "requestTracingEnabled": false,
                "remoteDebuggingEnabled": false,
                "httpLoggingEnabled": false,
                "logsDirectorySizeLimit": 35,
                "detailedErrorLoggingEnabled": false,
                "publishingUsername": "[concat('$',parameters('sites_etn_qnamaker_name'))]",
                "scmType": "None",
                "use32BitWorkerProcess": true,
                "webSocketsEnabled": false,
                "alwaysOn": false,
                "managedPipelineMode": "Integrated",
                "virtualApplications": [
                    {
                        "virtualPath": "/",
                        "physicalPath": "site\\wwwroot",
                        "preloadEnabled": false
                    }
                ],
                "loadBalancing": "LeastRequests",
                "experiments": {
                    "rampUpRules": []
                },
                "autoHealEnabled": false,
                "cors": {
                    "allowedOrigins": [
                        "*"
                    ],
                    "supportCredentials": false
                },
                "localMySqlEnabled": false,
                "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('sites_etn_qnamaker_name'), '/', parameters('sites_etn_qnamaker_name'), '.azurewebsites.net')]",
            "location": "West US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_etn_qnamaker_name'))]"
            ],
            "properties": {
                "siteName": "[parameters('sites_etn_qnamaker_name')]",
                "hostNameType": "Verified"
            }
        }
    ]
}

这里只是我检查过的一些网站

编辑:通过 qnamaker.ai 和 API 创建知识库均失败。在 qnamaker.ai 上,我在尝试创建知识库时收到此消息:

qnamaker.ai error message

这是我用来尝试以编程方式创建它的 PowerShell 脚本:

$body = Get-Content '$(System.DefaultWorkingDirectory)/_AveryCreek_OEM_CSC_Bot/models/qnamaker/Avery_Creek_Commercial_QnA.json' | Out-String

$header = @{
  "Content-Type"="application/json"
  "Ocp-Apim-Subscription-Key"="$(QNA_KEY)"
}

Invoke-RestMethod -Uri "https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/create" -Method 'Post' -Body $body -Headers $header

最佳答案

搜索端点 key 和 qnamaker 的问题会得到相当多的结果。

我刚刚通过 Azure 支持解决了同一问题的一个案例,以下是我们在解决此问题时检查的一些步骤,希望其中一个对将来遇到此问题的任何人都有用错误消息并没有给您提供太多信息:

  • 首先,查看故障排除常见问题解答 https://learn.microsoft.com/en-us/azure/cognitive-services/qnamaker/troubleshooting 。端点键没有任何问题,但是当您点击其他内容时,这是一个很好的起点。
  • 所有服务 - 检查您的命名。例如,对我来说,我的搜索服务的命名与我的配置的其余部分预期的不同,而且 api 属性中的认知服务运行时端点也不正确。不过仍然部署 - 如果您为以后创建的服务提供了不正确的名称,您并不总是会在服务本身上遇到错误,您只会在创建知识库时失败。
  • 所有服务 - 检查您的 SKU。虽然我发现免费/基本版没有问题,但免费订阅只能拥有 1 个 qna 认知服务,因此您需要随时拆除并重新创建或更新。
  • QnA 认知服务 - 配置设置(键和值)区分大小写
  • Qna 网络应用和网络应用计划 - 检查您的配额是否已达到,特别是内存和 CPU。
  • QnA Web 应用程序 - 您应该能够访问 https://{endpoint}/qnamaker/corehealthstatus 并看到像这样的积极 json 响应(或者如果存在 initException,则至少还有另一个错误需要处理)上):
{"processId":4920,"runtimeVersion":"5.46.0","initException":"","startupTime":"10/28/2020 2:44:39 PM"}
  • Qna Web 应用程序 - 您还应该能够访问 https://{endpoint}/qnamaker/proxyhealthstatus 并看到如下所示的积极 json 响应。
{
  "coreVersion": "5.46.0",
  "coreProcessId": 4920,
  "coreUrl": "http://localhost:50061"
}
  • Qna Web 应用程序 - 如果您的应用程序在这两个检查端点上没有显示类似的成功,请不要尝试创建知识库,无论是通过 qnamaker 门户还是动态创建 - 如果需要,请建立等待。如果您立即点击 API,您几乎肯定会通过 API 看到端点错误。

对于上面的检查端点,端点在门户中 Web 应用程序的概述部分中可见,通常是您的应用程序的名称,例如https://example-app-qnamaker-webapp.azurewebsites.net/qnamaker/corehealthstatus如果应用程序名为 example-app-qnamaker-webapp。在我自己的创建脚本中,我在创建知识库之前检查了 coreProcessId > 0,startupTime 是指示服务准备就绪的有效日期。

编辑:我还要补充一点,如果部署需要很长时间,则您的部分配置可能是错误的。每次我让事情正常工作时,都是快速部署(这适用于服务、知识库以及对 az cli 和 qnamaker REST API 的调用)。

关于azure - 通过 ARM 部署时无法在 QnA Maker 中创建 KB(未找到端点 key ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60764839/

相关文章:

azure - 主机头在 Azure 中不起作用

git - 在 Azure DevOps 中对 pull 请求运行选择性测试用例

azure-devops - 上传到 Azure Devops 的所有附件的最大大小是多少?

azure - 如何通过 Bicep 将功能应用程序键添加到logicapp应用程序设置

Azure 函数 Linux 消费计划位数

c# - 在 ASP Net Core 中实现两个身份验证选项( token 和证书)

visual-studio-2010 - 从 Visual Studio 连接到 tfs Azure

azure - 为什么使用 Azure 资源管理器 Powershell cmdlet 创建的子网 ID 为空?

Azure 资源管理器模板集 VM 时区

azure - 有没有办法让 WebJob 读取自定义配置部分(例如 AppSettings)?