< Back
Set-AzureRmNetworkSecurityGroup
Post
NAME Set-AzureRmNetworkSecurityGroup
SYNOPSIS
Sets the goal state for a network security group.
SYNTAX
Set-AzureRmNetworkSecurityGroup [-AsJob] [-DefaultProfile <IAzureContextContainer>] -NetworkSecurityGroup <PSNetworkSecurityGroup>
[<CommonParameters>]
DESCRIPTION
The Set-AzureRmNetworkSecurityGroup cmdlet sets the goal state for an Azure network security group.
PARAMETERS
-AsJob [<SwitchParameter>]
Run cmdlet in the background
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-NetworkSecurityGroup <PSNetworkSecurityGroup>
A network security group object representing the goal state to which the cmdlet sets the network security group.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
PSNetworkSecurityGroup
Parameter 'NetworkSecurityGroup' accepts value of type 'PSNetworkSecurityGroup' from the pipeline
OUTPUTS
Microsoft.Azure.Commands.Network.Models.PSNetworkSecurityGroup
NOTES
Example 1: Set the goal state for a network security group
PS C:\\>Get-AzureRmNetworkSecurityGroup -Name "Nsg1" -ResourceGroupName "Rg1" | Add-AzureRmNetworkSecurityRuleConfig -Name "Rdp-Rule" -Description
"Allow RDP" -Access "Allow" -Protocol "Tcp" -Direction "Inbound" -Priority 100 -SourceAddressPrefix "Internet" -SourcePortRange "*"
-DestinationAddressPrefix "*" -DestinationPortRange "3389" | Set-AzureRmNetworkSecurityGroup
This command gets the Azure network security group named Nsg1, and adds a network security rule named Rdp-Rule to allow Internet traffic on port
3389 to the retrieved network security group object using Add-AzureRmNetworkSecurityRuleConfig. The command persists the modified Azure network
security group using Set-AzureRmNetworkSecurityGroup .
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... uritygroup
Get-AzureRmNetworkSecurityGroup
New-AzureRmNetworkSecurityGroup
Remove-AzureRmNetworkSecurityGroup
SYNOPSIS
Sets the goal state for a network security group.
SYNTAX
Set-AzureRmNetworkSecurityGroup [-AsJob] [-DefaultProfile <IAzureContextContainer>] -NetworkSecurityGroup <PSNetworkSecurityGroup>
[<CommonParameters>]
DESCRIPTION
The Set-AzureRmNetworkSecurityGroup cmdlet sets the goal state for an Azure network security group.
PARAMETERS
-AsJob [<SwitchParameter>]
Run cmdlet in the background
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-NetworkSecurityGroup <PSNetworkSecurityGroup>
A network security group object representing the goal state to which the cmdlet sets the network security group.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
PSNetworkSecurityGroup
Parameter 'NetworkSecurityGroup' accepts value of type 'PSNetworkSecurityGroup' from the pipeline
OUTPUTS
Microsoft.Azure.Commands.Network.Models.PSNetworkSecurityGroup
NOTES
Example 1: Set the goal state for a network security group
PS C:\\>Get-AzureRmNetworkSecurityGroup -Name "Nsg1" -ResourceGroupName "Rg1" | Add-AzureRmNetworkSecurityRuleConfig -Name "Rdp-Rule" -Description
"Allow RDP" -Access "Allow" -Protocol "Tcp" -Direction "Inbound" -Priority 100 -SourceAddressPrefix "Internet" -SourcePortRange "*"
-DestinationAddressPrefix "*" -DestinationPortRange "3389" | Set-AzureRmNetworkSecurityGroup
This command gets the Azure network security group named Nsg1, and adds a network security rule named Rdp-Rule to allow Internet traffic on port
3389 to the retrieved network security group object using Add-AzureRmNetworkSecurityRuleConfig. The command persists the modified Azure network
security group using Set-AzureRmNetworkSecurityGroup .
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... uritygroup
Get-AzureRmNetworkSecurityGroup
New-AzureRmNetworkSecurityGroup
Remove-AzureRmNetworkSecurityGroup