azure-rest-api-specs icon indicating copy to clipboard operation
azure-rest-api-specs copied to clipboard

Unable to filter by multiple provisioningState on deployment list

Open wiwski opened this issue 2 years ago • 10 comments
trafficstars

  • Package Name: azure-mgmt-resource
  • Package Version: 22.0.0
  • Operating System: Ubuntu
  • Python Version: 3.10.8

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.

wiwski avatar Feb 20 '23 18:02 wiwski

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

ghost avatar Feb 21 '23 18:02 ghost

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}'",
)

Wzb123456789 avatar Feb 22 '23 07:02 Wzb123456789

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 avatar Feb 23 '23 08:02 wiwski

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

wiwski avatar Mar 02 '23 09:03 wiwski

@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.

SaurabhSharma-MSFT avatar Mar 10 '23 19:03 SaurabhSharma-MSFT

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 !

wiwski avatar Mar 08 '24 16:03 wiwski

Please help on this issue @ChenxiJiang333

msyyc avatar Jul 03 '24 05:07 msyyc

got it

ChenxiJiang333 avatar Jul 03 '24 05:07 ChenxiJiang333

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.

ChenxiJiang333 avatar Jul 04 '24 06:07 ChenxiJiang333

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

APErebus avatar Oct 29 '24 00:10 APErebus