Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PowerShell script to help manage an Azure VNet NSG rule.
$nsg = Get-AzureRmNetworkSecurityGroup -ResourceGroupName $resourceGroupName -Name $networkSecurityGroupName
Set-AzureRmNetworkSecurityRuleConfig -Name $securityRuleName `
-NetworkSecurityGroup $nsg `
-Access $allowOrDeny `
-Protocol Tcp `
-SourcePortRange * `
-DestinationPortRange 5986 `
-SourceAddressPrefix * `
-Priority $priority `
-Direction Inbound `
-DestinationAddressPrefix *
Set-AzureRmNetworkSecurityGroup -NetworkSecurityGroup $nsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment