Skip to content

ODataQuery parametr of Get-AzureRmResource still fails to add $filter properly #3946

Open
@eosfor

Description

@eosfor

Cmdlet(s)

PowerShell Version

PSVersion 5.0.10586.117

Module Version

Get-AzureRmResource : 4.0.0 : AzureRM.Resources

OS Version

10.0.10586.117

Description

$RateCardApiVersion = "2015-06-01-preview"
$Currency = USD
$Locale = en-US
$RegionInfo = US
$OfferDurableId = MS-AZR-0003P
$subscriptionId = 'some GUID'
$uri = "/subscriptions/{0}/providers/Microsoft.Commerce/RateCard" -f $subscriptionId
$query = "`$filter=OfferDurableId eq '{0}' and Currency eq '{1}' and Locale eq '{2}' and RegionInfo eq '{3}'" -f $OfferDurableId, $Currency, $Locale, $RegionInfo

Get-AzureRmResource -ResourceId $uri -ApiVersion $RateCardApiVersion -ODataQuery $query -Debug -Verbose

This fails with Get-AzureRmResource : {"Message":"Invalid query specified. Please specify a valid filter in format of $filter"}

Debug Output

in the debug output I see the following
the request URI seems to be wrong, it misses $filter completely

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/some guid/providers/Microsoft.Commerce/RateCard?OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq
'US'&api-version=2015-06-01-preview

Headers:
User-Agent                    : AzurePowershell/v4.0.0.0,PSVersion/v5.0.10586.117
ParameterSetName              : Get a single resource by its Id.
CommandName                   : Get-AzureRmResource

Body:


DEBUG: ============================ HTTP RESPONSE ============================

Script/Steps for Reproduction

Metadata

Metadata

Assignees

Labels

ARMARM - CoreARM - Core TriagedService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions