I need to get the Specific Azure Object with a specific Tag like Dev-Tag and Test-Tag using the command in https://docs.microsoft.com/en-us/powershell/module/az.resources/get-aztag?view=azps-5.1.0
This one is working with the Resource Group object only:
$TagName = 'Test-Tag'
Get-AzResourceGroup | Where-Object {$_.Tags.Keys -match $TagName} | OGV
But this one is failed with nothing returned:
$TagName = 'Test-Tag'
Get-AzResource | Where-Object {$_.Tags.Keys -match $TagName} | OGV
So how to rectify the code above so it can be used to export all objects with those two tags as above, not just Resource groups?