热门获取 Azure 搜索服务查询密钥

Hot to get Azure Search Service query key

我需要来自 Microsoft 的列表查询键。Search/searchServices 使用 PoweShell 或 API。 到目前为止我调查的是:

Get-AzureRmResource -ResourceType "Microsoft.Search/searchServices/listQueryKeys" -ResourceGroupName 'resource-group-name' -ResourceName 'resource-name' -ApiVersion '2015-08-19' 

Returns 只有名称的对象数组:

@{Name=a}
@{Name=query-key-created-from-powershell}

我还没有找到 API 来获取查询键。 获取管理密钥的简单方法:

Invoke-AzureRmResourceAction -Action listAdminKeys -ResourceType "Microsoft.Search/searchServices" -ResourceGroupName 'resource-group-name' -ResourceName 'resource-name' -ApiVersion 2015-08-19

但我无法获得 QueryKeys。这不起作用:

Invoke-AzureRmResourceAction -Action listQueryKeys -ResourceType "Microsoft.Search/searchServices" -ResourceGroupName 'resource-group-name' -ResourceName 'resource-name' -ApiVersion 2015-08-19

docs仅指创建或删除Query Key。 如何获取查询键作为名称键集合?

尝试使用以下 cmdlet:

Get-AzureRmSearchQueryKey -ResourceGroupName "resourceGroupName" -ServiceName "serviceName"

https://docs.microsoft.com/en-US/powershell/module/azurerm.search/get-azurermsearchquerykey?view=azurermps-6.11.0

检查你的 Azure PowerShell 版本是否正确。

要获取 Azure 搜索服务的查询键,@Victor Silva 的解决方案可以正常工作。

Get-AzureRmSearchQueryKey -ResourceGroupName "resourceGroupName" -ServiceName "serviceName"

I have download in my AzureDevOps task 'xxxx' 6.11.0 but AzureRM.Search is not part of it

关于您进一步的问题,由于AzureRM.Search模块是预览版,因此未包含在AzureRM 6.11.0模块中,请参阅包详情 在这个 link. So if you want to use this command Get-AzureRmSearchQueryKey, you need to install the AzureRM.Search independently, use Install-Module -Name AzureRM.Search -AllowPrerelease, refer to this link.

更新:

如果你想通过 API 列出查询键,你可以使用这个 REST API

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys?api-version=2015-08-19