我在 ARM 模板中使用这段代码作为输出对象,
"[listAdminKeys(variables('searchServiceId'), '2015-08-19').PrimaryKey]"
输出部分的全文示例:
"outputs": {
"SearchServiceAdminKey": {
"type": "string",
"value": "[listAdminKeys(variables('searchServiceId'), '2015-08-19').PrimaryKey]"
},
"SearchServiceQueryKey": {
"type": "string",
"value": "[listQueryKeys(variables('searchServiceId'), '2015-08-19')[0]]"
}
我在部署过程中收到以下错误(不幸的是,任何错误都意味着模板部署会跳过输出部分):
"The requested resource does not support http method 'POST'."
检查浏览器行为似乎可以验证错误是否与该功能相关(并且它使用 POST)。
如何避免此错误并在输出中检索 AzureSearch 管理 key ?
更新:这样做的目的是收集所有相关的信息,以作为参数插入其他脚本 (.ps1),因为这些资源是由该模板提供的。可以让某人免于通过门户进行复制/粘贴。
谢谢
最佳答案
您的错误来自 listQueryKeys,而不是管理 key 。
https://learn.microsoft.com/en-us/rest/api/searchmanagement/adminkeys/get
https://learn.microsoft.com/en-us/rest/api/searchmanagement/querykeys/listbysearchservice
您将无法检索arm模板中的那些内容,它只能“模拟”POST调用,而不是GET
关于Azure 搜索、listAdminKeys、ARM 输出错误(不支持 http 方法 'POST' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53416519/