< Back

New-NsxSecurityPolicyAssignment

Sat Jan 18, 2020 9:19 pm

NAME New-NsxSecurityPolicyAssignment



SYNOPSIS

Applies a Security Policy to the specified Security Group.





SYNTAX

New-NsxSecurityPolicyAssignment [-SecurityPolicy] <XmlElement> [[-SecurityGroup] <XmlElement[]>] [[-Connection]

<PSObject>] [<CommonParameters>]





DESCRIPTION

A security policy is a policy construct that can define one or more rules in

several different categories, that can then be applied to an arbitrary

number of Security Groups in order to enforce the defined policy.



The New-NsxSecurityPolicyAssignment cmdlet applies the specified Security

Policy to the specified Security Group.





PARAMETERS

-SecurityPolicy <XmlElement>

Security Policy to be applied.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-SecurityGroup <XmlElement[]>

Security Group to which to apply the specified policy. Can specify a collection of security groups to perform

assignment of policy to multiple groups.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Connection <PSObject>

PowerNSX Connection object



Required? false

Position? 3

Default value $defaultNSXConnection

Accept pipeline input? false

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 (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$sg = Get-NsxSecurityGroup WebApp1WebServers



PS C:\\> Get-NsxSecurityPolicy WebServers | New-NsxSecurityPolicyAssignment -SecurityGroup $sg



Applies the Security Policy WebServers to the Security Group WebApp1WebServers.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$AllSecurityGroups = Get-NsxSecurityGroup



PS C:\\> Get-NsxSecurityPolicy Mandatory | New-NsxSecurityPolicyAssignment -SecurityGroup $AllSecurityGroups



Applies the Security Policy Mandatory to all defined Security Groups.











RELATED LINKS