Azure / Azure/azure-powershell
Hashtable into Get-AzResource -Tag $QueryTag returns results as if it's OR instead of AND
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
So I have a hashtable of tags and values that I know are on a virtual machine in the environment.
$QueryTags = @{"Technical:AlwaysPatch" = "yes"; "Technical:PatchingOwner" = "NamedPerson";"Technical:PatchingSchedule" = "Default"; "Technical:Environment" = "NONPROD"}
When I do Get-AzResource -Tag $QueryTags I get a response with all the resources in the subscription.
The problem is there's only one virtual machine in the subscription that has this combination of tags. Nothing in the documentation indicates that the -Tag parameter is an OR or AND function. I thought it would be an AND function like the query section from New-AzAutomationUpdateManagementAzureQuery.
Is there something I'm missing?
### Script or Debug output
_No response_
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 5.1.19041.1682
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1682
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```
### Module versions
```PowerShell
PS C:\WINDOWS\system32> Get-Module Az*
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.9.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script 6.1.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment...}
```
### Error output
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.