MO-Senpai
MO-Senpai

Reputation: 57

How to get all Azure Resources without tags in a Azure Resource Group excluding Hidden tags

I am able to filter the resources without tags using below script

Get-AzResource | Where-Object {$null -eq $_.Tags -or $_.Tags.Count -eq 0} | Format-Table -AutoSize but the problem it is including the hidden resources along with it.

My requirement is to filter the tags without hidden types.

Can anyone help me?

Upvotes: 1

Views: 3013

Answers (2)

Sunil Jose
Sunil Jose

Reputation: 11

Easiest way is use Azure Graph explorer, run this query,

resources
|where tags !has "your tag name"

//this will show the all the resource which does not have the tag with "your tag name"

Upvotes: 1

Ecstasy
Ecstasy

Reputation: 1864

You can use -notlike comparison operator to filter the tags without hidden types and run this PowerShell command:

Get-AzResource | Where-Object {$_ -notlike "hidden-*" } | Format-Table -AutoSize

You can refer to Comparison operators, GitHub issue at Hidden/Not Hidden flag for get-azresource and Get-AzureRmResource - parameter for excluding hidden resources

Upvotes: 1

Related Questions