Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.7k stars 5.12k forks source link

Invalid filter expression in DataSourcesListByWorkspace #22756

Open caroysMSFT opened 1 year ago

caroysMSFT commented 1 year ago

Ref:

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/DataSourcesListByWorkspace.json

"$filter": "kind='WindowsEvent'",

This is not valid. I make the call with AZ REST (for the sake of simplicity):

https://management.azure.com/subscriptions/e36582a6-9e0c-4644-9b78-592ffe29a705/resourcegroups/defaultresourcegroup-eus/providers/Microsoft.OperationalInsights/workspaces/Workspace-be596052-ca5c-4643-a5c0-c3aae3e7a f13-EUS/dataSources?$filter=kind='LinuxPerformanceObject'&api-version=2020-08-01

And what I get back is:

az : ERROR: Bad Request({"error":{"code":"KindNotSpecified","message":"Must specify a valid kind filter. For example, $filter=kind eq 'windowsPerformanceCounter'."}})

I Oblige the error message and switch to 'eq' and it goes well:

https://management.azure.com/subscriptions/e36582a6-9e0c-4644-9b78-592ffe29a705/resourcegroups/defaultresourcegroup-eus/providers/Microsoft.OperationalInsights/workspaces/Workspace-be596052-ca5c-4643-a5c0-c3aae3e7a f13-EUS/dataSources?$filter=kind eq 'LinuxPerformanceObject'&api-version=2020-08-01

I was sent on this wrong path by our official documentation, which is apparently based off the aforementioned API definition file:

https://learn.microsoft.com/en-us/rest/api/loganalytics/data-sources/list-by-workspace?tabs=HTTP

JackTn commented 11 months ago

@dulikvor can you help to see this issue, thanks!