You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, all but a few resources have a defined cost_center, and I have a subscription policy that places an "unknown" value for the tag "cost_center". This is using Azure Powershell 6.5. Previously, I used the command Find-AzureRmResource -TagName "cost_center" -TagValue "unknown" which pulled this list of resources that needed to be updated.
If I change the command (and update one of the resources to a cost_center of abc123, the PS command just returns the 1 resource. Additionally, the Azure portal properly displays the "unknown" cost center resources appropriately, so I believe this to be a bug in Azure PS 6.5
@Woodrum good catch! I'm able to reproduce this on my machine. It looks like our logic is incorrect when handling the scenario where both a name and value are provided, but is correct when only one of the two is provided. Let me open a PR to fix this and hopefully get it into our next release.
In the meantime, you can workaround this issue with the following commands:
$name="cost_center"$value="unknown"Get-AzureRmResource-ResourceGroupName $RG|where { $_.Tags[$name] -eq$value } | ft
@cormacpayne - thanks a lot... the workaround is great. To be clear, the command did work when the value I passed was anything but "unknown". So passing both a name and value works, but if the value is "unknown" it displayed all resources.
Description
From this article: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-using-tags
When performing this command, I receive an output of all resources in the resource group $RG.
(Get-AzureRmResource -ResourceGroupName $RG -Tag @{cost_center="unknown"}).Name
In this case, all but a few resources have a defined cost_center, and I have a subscription policy that places an "unknown" value for the tag "cost_center". This is using Azure Powershell 6.5. Previously, I used the command Find-AzureRmResource -TagName "cost_center" -TagValue "unknown" which pulled this list of resources that needed to be updated.
If I change the command (and update one of the resources to a cost_center of abc123, the PS command just returns the 1 resource. Additionally, the Azure portal properly displays the "unknown" cost center resources appropriately, so I believe this to be a bug in Azure PS 6.5
Script/Steps for Reproduction
(Get-AzureRmResource -ResourceGroupName $RG -Tag @{cost_center="unknown"}).Name
Module Version
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
Script 6.5.0 AzureRM
Script 5.7.0 AzureRM
Environment Data
$PSVersionTable
Name Value
PSVersion 5.1.17134.137
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.137
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Debug Output
The text was updated successfully, but these errors were encountered: