Skip to content
Back to skills

Lookup Nsg

ASecurity

Finds the Network Interface Card (NIC) and associated Network Security Group (NSG) for a VM given its public IP address.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsshellsecurity

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill lookup-nsg --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Lookup Nsg?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Lookup Nsg
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/fabioc-aloha-lookup-nsg/badge)](https://www.skillsdirectory.com/skills/fabioc-aloha-lookup-nsg)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: lookup-nsg
description: "Finds the Network Interface Card (NIC) and associated Network Security Group (NSG) for a VM given its public IP address."
lastReviewed: 2026-04-30
---

# Skill: NSG Lookup

Finds the Network Interface Card (NIC) and associated Network Security Group (NSG) for a VM given its public IP address.

## Step 1 — Find the Public IP Resource

Run via PowerShell:

```powershell
Search-AzGraph -Query "resources | where type =~ 'microsoft.network/publicipaddresses' | where properties.ipAddress == '<IP_ADDRESS>' | project publicIpName=name, resourceGroup, subscriptionId, ipAddress=properties.ipAddress, attachedResource=properties.ipConfiguration.id"
```

Replace `<IP_ADDRESS>` with the user's IP. If no results, tell the user the IP was not found and ask them to verify.

## Step 2 — Look Up the NIC and NSG

Extract the NIC resource ID from `attachedResource` by removing the `/ipConfigurations/...` suffix. Then:

```powershell
Search-AzGraph -Query "resources | where type =~ 'microsoft.network/networkinterfaces' | where id == '<NIC_RESOURCE_ID>' | project nicName=name, nicNsgId=properties.networkSecurityGroup.id, subnetId=properties.ipConfigurations[0].properties.subnet.id"
```

## Step 3 — Present Results

Show a summary table:

| Property | Value |
|----------|-------|
| **Public IP** | (ip address) |
| **Public IP Resource** | (name) |
| **Resource Group** | (resource group) |
| **Subscription** | (subscription id) |
| **NIC Name** | (nic name) |
| **Associated NSG** | (nsg id, or "None") |
| **Subnet** | (subnet id) |

If the NIC has **no NSG**, warn the user it is unprotected.

Extract the **NSG name**, **resource group**, and **subscription ID** from the results to pass into the NSG Remediation skill.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.