Azure Search、listAdminKeys、ARM 输出错误(不支持http方式'POST')
Azure Search, listAdminKeys, ARM output error (does not support http method 'POST')
我在我的 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)。
listAdminKeys using POST
如何避免此错误并在输出中检索 AzureSearch 管理密钥?
更新:这样做的目的是收集所有相关信息位作为参数插入其他脚本 (.ps1),因为这些资源是由该模板提供的。可以避免有人通过门户挖掘 copy/paste。
谢谢
您的错误来自 listQueryKeys,而不是管理密钥。
https://docs.microsoft.com/en-us/rest/api/searchmanagement/adminkeys/get
https://docs.microsoft.com/en-us/rest/api/searchmanagement/querykeys/listbysearchservice
你无法在 arm 模板中检索它们,它只能 "emulate" POST 调用,不能 GET
使用最新的 API 版本,可以使用以下方法获取查询键:
"SearchServiceQueryKey": {
"type": "string",
"value": "[listQueryKeys(variables('searchServiceId'), '2020-06-30').value[0].key]"
}
我在我的 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)。
listAdminKeys using POST
如何避免此错误并在输出中检索 AzureSearch 管理密钥?
更新:这样做的目的是收集所有相关信息位作为参数插入其他脚本 (.ps1),因为这些资源是由该模板提供的。可以避免有人通过门户挖掘 copy/paste。
谢谢
您的错误来自 listQueryKeys,而不是管理密钥。
https://docs.microsoft.com/en-us/rest/api/searchmanagement/adminkeys/get
https://docs.microsoft.com/en-us/rest/api/searchmanagement/querykeys/listbysearchservice
你无法在 arm 模板中检索它们,它只能 "emulate" POST 调用,不能 GET
使用最新的 API 版本,可以使用以下方法获取查询键:
"SearchServiceQueryKey": {
"type": "string",
"value": "[listQueryKeys(variables('searchServiceId'), '2020-06-30').value[0].key]"
}