How to retrieve Azure FW & NSG info based on there tags?

Ananya Sarkar 311 Reputation points
2020-12-10T05:00:58.663+00:00

1) How to retrieve Azure FW & NSG info based on there tags? I have a FW that have a tag (name = test), so I tried this query but its returning all the firewalls and not the filtered list
Get-AzFirewall | Where-Object Tags -eq $name | Select-Object -Property Name, ResourceType
2) Also how to retrieve Azure FW & NSG info based on a tag that is not there, say I want to retrieve FW/NSG list where name = test is not present?

I need the query for both FW & NSG lists related to the above 2 conditions.

Azure Firewall
Azure Firewall
An Azure network security service that is used to protect Azure Virtual Network resources.
667 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ananya Sarkar 311 Reputation points
    2020-12-11T18:45:31.677+00:00

    @suvasara-MSFT , can you plz respond?


  2. suvasara-MSFT 10,041 Reputation points
    2020-12-15T17:16:50.193+00:00

    @Ananya Sarkar , Here are the PS commands to get Azure resource info using their tag values.

     Azure Firewall:  
     Get-AzResource -ResourceType Microsoft.Network/azureFirewalls -Tag @{'Name'='Test'}  
     Azure NSG:  
    Get-AzResource -ResourceType Microsoft.Network/networkSecurityGroups -Tag @{'Name'='Test'}  
    

    ----------

    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.