Filtering on a scpefic tag and its value

Hello,

For a particular subscription that has many resources, i would like to filter output to check for all resources that match a certain type (either disk or network card), where the tagname for the resource is “operationalStatus” and it can have within its value (i.e sub string) the string “orphan:True”

I am not certain how to filer

I am new to powershell and not certain of the syntax, although the command:

get-azresource -tagname “operationalStatus” -Tagvalue “orphan:True”

is close to what I want. I would like to use -match for Tagvalue, but not certain of proper syntax. Is it possible to filter as described?

Thanks in advance,

Buddd

Mark,
Welcome to the forum. :wave:t4:

For me it’s not completely clear what you’re looking for. The parameters -Tag, -TagName and -TagValue do not accept wildcards. If you want to use the -like or the -match operator you will have to use a Where-Object in a pipeline.

BTW: When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org <---- Click :point_up_2:t4: :wink: