Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (16 sloc) 523 Bytes
$path = "c:\temp\openports.txt"
#log into Azure Account if needed
IF (-NOT (get-azcontext)){
#get all of the subs
$subs = get-azsubscription
foreach($sub in $subs){
set-azcontext -SubscriptionID $sub.ID
$nsgs = Get-AzNetworkSecurityGroup
foreach($nsg in $nsgs){
$nsg | get-aznetworksecurityruleconfig | where-object -FilterScript {$_.sourceaddressprefix -eq "*" -and $_.Access -eq "Allow"} | out-file -FilePath $path -Append
#open the file
invoke-item $path
You can’t perform that action at this time.