Fix querying through tags on Find-AzureRmResource and Find-AzureRmResourceGroup
Find-AzureRmResource -ODataQuery "$filter=tagname eq 'DBCheckService'" - this does not work. Currently the workaround is to do the following- Find-AzureRmResource | Where-Object {$.Tags.Name-eq "DBCheckService" -and $.Tags.Value -eq "true"}
Also, for Resource we support tagname and tagvalue but for resource group cmdlet we support tag.
You need to escape the "$" in the query parameter. Like this: -ODataQuery "`$filter=tagName eq 'DBCheckService'".
I'll add a Tag parameter for Find-AzureRmResource.
@TianoMS Please close if the issue is fixed. Otherwise, please assign to the appropriate milestone
There are 2 issues in this one - first is that querying through OData query didn't work. This one does not need fix as mentioned by Tian above. Second was adding the Tag param to Find-AzureRmResource cmdlet similar to what we have in Find-AzureRmResourceGroup cmdlet. this one needs to be fixed.
Closing as this is tracked through multiple other issues.
@ravbhatnagar Can you link to the other issues you refer to? I currently cannot find any open, and yet this issue still exists (at the API).
for instance, I'm getting:
Invalid $filter 'resourceType eq 'Microsoft.Compute/virtualMachines' and tagName eq 'myTagName' and tagValue eq 'myTagValue'' specified in the query string."
@JoeBrockhaus - As noted by @TianoMS in one of the comments above, for the $filter to work in the query,"$" needs to be escaped with `. Please let me know if you still see this issue.
@ravbhatnagar I see. I don't think this is something I have direct control over, as I'm using the ResourceManagementClient from v1.4.0-preview of Microsoft.Azure.Management.ResourceManager.
I just created a bug over there, I'll reference your comment. Thanks.
Get-AzureRmResource -ODataQuery "`$filter=tagname eq 'schedule'" -TenantLevel
doesnt work, but this does:
Get-AzureRmResource -ODataQuery "`$filter=tagname eq 'schedule'"
bug? probably feature, right? :)
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @rthorn17