Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.58k stars 2.8k forks source link

`properties/providerName` not working on API_VERSION 2022-12-01-preview. #33474

Closed brendalf closed 10 months ago

brendalf commented 10 months ago

Describe the bug I have a code where I list all the incidents coming from Azure Sentinel. I need to filter the incidents by severity and if the providerName is equal to "Azure Sentinel". The code works up to the API version 2022-06-01-preview but not in the default one (2022-12-01-preview). Filtering by this value in the az cli also works.

To Reproduce Steps to reproduce the behavior:

  1. az sentinel list -g RESOURCE_GROUP -w WORKSPACE_NAME --filter "properties/providerName eq 'Azure Sentinel'" works.
  2. The following code also works if the api version 2022-06-01-preview is hardcoded:
    response = self.security_insights.incidents.list(
    resource_group_name=resourcegroup_name,
    workspace_name=workspace_name,
    filter="properties/providerName eq 'Azure Sentinel'",
    orderby="properties/createdTimeUtc desc",
    api_version="2022-06-01-preview",  # required for the providerName property
    )

Expected behavior Since the az CLI works and the providerName property is listed in the official documentation, I believe something is wrong in the default API version 2022-12-01-preview.

The code also works if I set the api_version param to be 2023-02-01 (based on the securityinsights package documentation), so maybe we just need to update the default version to the newest one? I'm happy to open a pull request.

xiangyan99 commented 10 months ago

Thanks for the feedback, we’ll investigate asap.

ChenxiJiang333 commented 10 months ago

Hi @brendalf Thanks for pointing it out, yet, as the SDK was automatically generated, it's not suggested to directly make changes on it. Instead, since this error was raised by service, I suggest to open an issue in https://github.com/Azure/azure-rest-api-specs/issues to turn to the service team to fix it on the service side.