NSG Open Management Port Finder

    by Abdelrhman Fikri

    1

    This skill gives your agent a deterministic, offline workflow: export your NSGs, run the bundled finder, and read a short list of exposed ports with the rule name and priority.

    Free

    Security scanned

    Works with the AI Agents you already use

    What it does

    • Reads az network nsg list output, rule lists and ARM templates that contain network security groups
    • Flags inbound Allow rules open to any source on SSH, RDP, WinRM, Telnet, SMB and VNC ports as blockers
    • Flags rules that open every port, including ranges that cover a management port
    • Warns about database and Docker API ports and very wide source ranges
    • Marks Allow rules that an earlier Deny rule already blocks as not effective
    • Notes network security groups with no subnet or interface association in the export

    Who it's for

    Cloud and platform engineers

    security reviewers and auditors who need a quick list of internet-exposed management ports from an NSG export.

    Anyone reviewing an ARM template pull request

    who wants open management ports caught before merge.

    NSG Open Management Port Finder

    Example session with this skill installed

    Command: python3 scripts/find_open_ports.py examples/dirty/nsg-list.json

    • Read your context and instructions
    • Compiled the nsg open management

    The sample export has SSH, RDP and WinRM open to the internet, a rule that opens every port, a SQL Server rule open to Internet, an Allow rule that an earlier Deny already blocks, and a Deny rule that only covers one of two exposed ports.

    [BLOCKER] nsg-list.json: nsg 'nsg-web' rule 'AllowSsh' (priority 100): inbound Allow from any internet source (*) to 22 SSH; management ports should sit behind Bastion, a VPN or a narrow allowed range
    [BLOCKER] nsg-list.json: nsg 'nsg-web' rule 'AllowRdpWinRm' (priority 110): inbound Allow from any internet source (0.0.0.0/0) to 3389 RDP, 5985 WinRM HTTP, 5986 WinRM HTTPS; management ports should sit behind Bastion, a VPN or a narrow allowed range
    [WARN] nsg-list.json: nsg 'nsg-web' rule 'AllowSshAzureCloud' (priority 150): inbound Allow from a very wide source range (AzureCloud) to 22 SSH; narrow the source range
    [WARN] nsg-list.json: nsg 'nsg-web' rule 'AllowSqlInternet' (priority 300): inbound Allow from any internet source (Internet) to 1433 SQL Server; data ports should not be reachable from the internet
    [WARN] nsg-list.json: nsg 'nsg-web' rule 'AllowDockerMongo' (priority 350): inbound Allow from any internet source (Internet) to 2375 Docker API, 27017 MongoDB; data ports should not be reachable from the internet
    [BLOCKER] nsg-list.json: nsg 'nsg-web' rule 'AllowEverything' (priority 400): inbound Allow from any internet source (*) to all ports
    [INFO] nsg-list.json: nsg 'nsg-app' rule 'AllowSshInternet' (priority 100): inbound Allow from any internet source (Internet) to 22 SSH; management ports should sit behind Bastion, a VPN or a narrow allowed range; not effective: shadowed by Deny rule 'DenyInternetAdmin' (priority 90)
    [INFO] nsg-list.json: nsg 'nsg-app' rule 'AllowSshRdpInternet' (priority 200): inbound Allow from any internet source (*) to 22 SSH, 3389 RDP; management ports should sit behind Bastion, a VPN or a narrow allowed range; not effective: shadowed by Deny rule 'DenyInternetAdmin' (priority 90)
    [BLOCKER] nsg-list.json: nsg 'nsg-partial' rule 'AllowAdminInternet' (priority 100): inbound Allow from any internet source (Internet) to 22 SSH, 3389 RDP; management ports should sit behind Bastion, a VPN or a narrow allowed range
    [INFO] nsg-list.json: nsg 'nsg-orphan': the export shows no subnet or network interface association; rules have no effect until it is attached
    Summary: 4 blocker(s), 3 warning(s), 4 nsg(s), 1 file(s)
    

    Command: python3 scripts/find_open_ports.py examples/clean

    The clean sample uses narrow sources, a virtual network source for RDP, and a final Deny rule, and returns exit code 0:

    Summary: 0 blocker(s), 0 warning(s), 1 nsg(s), 1 file(s)
    

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The fastest way to lose a virtual machine is an NSG rule that lets the whole internet reach RDP or SSH. Portal reviews miss rules buried in long lists, in port ranges, or in ARM templates. This skill gives your agent a deterministic, offline workflow: export your NSGs, run the bundled finder, and read a short list of exposed ports with the rule name and priority.

    The finder is a single standard-library script. It does not call Azure and never changes a rule. It reads the output of az network nsg list, a plain rule list, or an ARM template that contains network security groups or child security rules. For each inbound Allow rule it works out the source (any, Internet, a very wide range, or narrow) and the destination ports, including ranges and lists. Management ports open to any source are blockers. A rule that opens every port is a blocker. Database and Docker API ports, and sources such as AzureCloud or a huge public range, are warnings. Because Azure evaluates the lowest priority number first, an Allow rule that an earlier Deny rule already covers is marked not effective instead of raising a false alarm.

    Synthetic example files with expected output are included so you can verify the behaviour in seconds.

    • It reads exported rules; it cannot see effective security rules after Azure Firewall, Application Security Groups or Virtual WAN, and it does not test real reachability.
    • Only the fixed management and data port lists are checked; custom admin ports are not.
    • Source and destination address prefixes are treated as a whole: a rule limited to one destination address is still reported, because the export alone cannot show what runs there.
    • An Allow rule is called shadowed only when an earlier Deny rule from an open source covers all of the exposed ports.
    • Reports and explains; it never edits rules.

    The finder is a single standard-library Python script. It makes no network calls and never writes files. Give it files or directories; it reads .json. Accepted input: the output of az network nsg list (securityRules with flat or nested properties), a list of rules from az network nsg rule list (grouped by the NSG name in each rule id), or an ARM template with networkSecurityGroups and child securityRules resources. Only inbound Allow rules with TCP, UDP or any protocol are checked. Source classes: open (*, 0.0.0.0/0, Internet, Any), wide (the AzureCloud tag or a public IPv4 range of /8 or larger) and narrow. Destination ports are parsed from single ports, lists and ranges. Management ports: 22, 23, 445, 3389, 5900, 5985, 5986. Data ports: 1433, 1521, 2375, 3306, 5432, 6379, 9200, 27017. An Allow rule is marked not effective when a lower-numbered inbound Deny rule from an open source covers all its exposed ports. Exit codes: 0 no blockers, 1 blockers found, 2 bad arguments. Options: --format json, --hide-info.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Frequently Asked Questions

    No. It only reads the JSON files you give it.

    Yes. A lower priority number is evaluated first, and an Allow that an earlier Deny already blocks is marked not effective.

    Not directly. Build the Bicep to an ARM template first, or export the NSGs with az.

    Python 3.9 or newer, no packages to install.

    One or more BLOCKER findings. Warnings alone still exit 0.

    New in DevOps & Cloud

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.

    Free