Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.67k stars 5.09k forks source link

Unable to filter by multiple provisioningState on deployment list #29700

Open wiwski opened 1 year ago

wiwski commented 1 year ago

Describe the bug I am unable to retrieve deployments when filtering by provisioning state with OR operator. I tried the filter query with REST API and it works.

azure.core.exceptions.HttpResponseError: (InvalidProvisioningStateFilter) Invalid $filter 'provisioningState eq 'accepted' or provisioningState eq 'updating'' specified in the query string.
Code: InvalidProvisioningStateFilter
Message: Invalid $filter 'provisioningState eq 'accepted' or provisioningState eq 'updating'' specified in the query string.

To Reproduce Steps to reproduce the behavior:

ResourceManagementClient(...).deployments.list_by_resource_group(
       resource_group_name=<resource_group_name>,
       filter="provisioningState eq 'accepted' or provisioningState eq 'updating'",
)

Expected behavior I expect to retrieve the list of deployments with provisioning state accepted or running.

ghost commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

Wzb123456789 commented 1 year ago

Hi @wiwski

Please try the following:

ResourceManagementClient(...).deployments.list_by_resource_group(
       resource_group_name=<resource_group_name>,
       filter="provisioningState eq '{accepted}' or provisioningState eq '{updating}'",
)
wiwski commented 1 year ago

Hi @Wzb123456789,

Thanks for the support. I am getting the same error with your suggestion.

ongoing_deployments = self._resource_mgmt_client.deployments.list_by_resource_group(
            resource_group_name=self.resource_group_name,
            filter="provisioningState eq '{accepted}' or provisioningState eq '{updating}'",
)
Code: InvalidProvisioningStateFilter
Message: Invalid $filter 'provisioningState eq '{accepted}' or provisioningState eq '{updating}'' specified in the query string.

Is it working on your side ?

wiwski commented 1 year ago

Hi, any update on this ? Is this something that is not just posible at the REST API level ?

SaurabhSharma-MSFT commented 1 year ago

@wiwski sorry for the delay on this one. I am able to reproduce this and as per my understanding it looks like a limitations at services end as the Deployments REST API is also not able to handle filters with multiple conditions. Please check the below response - image

@Wzb123456789 Can you please look into this.

wiwski commented 7 months ago

Hello,

Any update on this issue ?

I just noticed ne (for not equal) filter is not available as well. It would be great at least to have this (to filter out Succeeded deployment).

Thanks !

msyyc commented 4 months ago

Please help on this issue @ChenxiJiang333

ChenxiJiang333 commented 4 months ago

got it

ChenxiJiang333 commented 4 months ago

Hi @wiwski, provisioningState eq 'accepted' or provisioningState eq 'updating should be a correct odata syntax, yet I don't know somehow the api does not accept it, since it's a service issue, python sdk can not make any change on it. So I would transfer this issue to seek help from service team.

APErebus commented 3 days ago

Just following up on this, I'm trying to filter resource groups that are not provisioning, but this filter is not working

provisioningState ne 'deleting'

I receive

{
  "error": {
    "code": "InvalidFilterInQueryString",
    "message": "Invalid $filter 'provisioningState ne 'deleting'' specified in the query string."
  }
}

It seems you can't filter on provisioningState at all?

A filter of provisioningState eq 'succeeded' gives the same error