我正在尝试生成Azure搜索服务,并与之一起生成查询键。该如何做以及以后如何在arm模板中检索它?
到目前为止,我的搜索脚本是
{
"apiVersion": "2015-08-19",
"name": "[variables('azureSearchName')]",
"location": "australiaeast",
"sku": {
"name": "basic"
},
"type": "Microsoft.Search/searchServices",
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"hostingMode": "Default"
}
}
并获取其管理密钥:
"searchKey": {
"type": "string",
"value": "[listAdminKeys(resourceId('ResourceGroup', 'Microsoft.Search/searchServices', 'SearchName'), '2015-08-19').PrimaryKey]"
}
更新
从@ 4c74356b41回答后,我继续进行一些挖掘,并在Microsoft.Search - /searchServices/listQueryKeys/read上找到了此操作。不幸的是,它是“读取”而不是“动作”,因此当我尝试像这样使用它时:
"searchKey": {
"type": "object",
"value": "[listQueryKeys(resourceId('Microsoft.Search/searchServices', 'SearchName'), '2015-08-19')]"
}
我得到了
部署失败。相关ID: 486ae99b-839d-43bf-93e7-f0e2afc3f19a。 {“ Message”:“ 资源不支持http方法“ POST”。“}
如何使用GET调用它?
答案 0 :(得分:0)
它可能看起来像这样:
{
"apiVersion": "2015-08-19",
"name": "[concat(variables('azureSearchName'), '/keyNamegoesHere')]",
"location": "australiaeast",
"type": "Microsoft.Search/searchServices/createQueryKey"
}
但是如果那不起作用,我不会感到惊讶。阅读:https://docs.microsoft.com/en-us/rest/api/searchmanagement/querykeys/create