< Back

Add-NsxDynamicCriteria

Sat Jan 18, 2020 8:58 pm

NAME Add-NsxDynamicCriteria



SYNOPSIS

Adds a Dynamic Criteria to the specified Dynamic Member Set.





SYNTAX

Add-NsxDynamicCriteria [-DynamicMemberSet] <Object> -DynamicCriteriaSpec <XmlElement> [-Connection <PSObject>]

[<CommonParameters>]



Add-NsxDynamicCriteria [-DynamicMemberSet] <Object> -Key <String> -Condition <String> -Value <String> [-Connection

<PSObject>] [<CommonParameters>]



Add-NsxDynamicCriteria [-DynamicMemberSet] <Object> -Entity <Object> [-Connection <PSObject>] [<CommonParameters>]





DESCRIPTION

NSX Security Groups can have 3 types of membership configured, Dynamic

Criteria, Static Members and Exclude Members.



One or more Dynamic Criteria combine to make a Dynamic Member Set, and one

or more Dynamic Member Sets combine to define the Dynamic Membership of a

given security group.



In order to allow the configuration of a security groups Dynamic Membership

with an aritrary number of Dynamic Criteria Member Sets that contain an

arbitrary number of Dynamic Criteria in a flexible way, PowerNSX provides

the following abstractions.



Creation of individual Dynamic Criteria is accomplished with

New-NsxDynamicCriteriaSpec.



One or more Dynamic Criteria can be added to a Dynamic Member Set at creation

time with Add-NsxDynamicMemberSet and specifying the required Dynamic

Criteria Spec objects at creation time.



One or more Dynamic Criteria can be added to an existing Dynamic Member Set

after the fact with Add-NsxDynamicCriteria or removed with

Remove-NsxDynamicCriteria.



One or more Dynamic Member sets can be added to a security groups overall

Dynamic Membership definition using Add-NsxDynamicMemberSet or removed using

Remove-NsxDynamicMemberSet



A Security Groups Dynamic Member definition can include multiple Dynamic

Member Sets in an logical AND/OR arrangement, and for each of the Dynamic

Member Sets, a match operator of ALL or ANY can be specified that determines

how multiple Dynamic Criteria combine within the set to define a match.



Add-NsxDynamicCriteria adds a new Dynamic Member Criteria to the specified

Dynamic Member Set as retrieved by Get-NsxDynamicMemberSet. You can pass

a Dynamic Member Spec as created by New-NsxDynamicMemberSpec, or explicitly

specify the key, condition and value of the new Dynamic Criteria.





PARAMETERS

-DynamicMemberSet <Object>

SecurityGroup to retrieve Dynamic Sets from.



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-DynamicCriteriaSpec <XmlElement>

Dynamic criteria spec/s as generated by New-NsxDynamicCriteriaSpec



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Key <String>

Dynamic Criteria Key



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Condition <String>

Dynamic Criteria Condition



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Value <String>

Dynamic Criteria Value to be matched against the key using the condition.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Entity <Object>

A specific entity to match against.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Connection <PSObject>

PowerNSX Connection object



Required? false

Position? named

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:\\>Get-NsxSecurityGroup WebApp | Get-NsxDynamicMemberSet -Index 1 | Add-NsxDynamicCriteria -Entity (Get-VM

app01)



Index SecurityGroupName SetOperator CriteriaString

----- ----------------- ----------- --------------

1 WebApp Match: ANY, VMName contains WebApp, ComputerName regex *webapp*, ENTITY

belongs_to vm-1234



Adds a new Dynamic Criteria for a static inclusion of the VM app01 to the existing first Dynamic Member Set of the

Security Group WebApp









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



PS C:\\>$spec1 = New-NsxDynamicCriteriaSpec -key SecurityTag -condition equals -value "webapp"



PS C:\\> Get-NsxSecurityGroup WebApp | Get-NsxDynamicMemberSet -Index 1 | Add-NsxDynamicCriteria

-DynamicCriteriaSpec $spec1



Index SecurityGroupName SetOperator CriteriaString

----- ----------------- ----------- --------------

1 WebApp Match: ANY, VMName contains WebApp, ComputerName regex *webapp*, ENTITY

belongs_to vm-1234, SecurityTag equals webapp



Adds a new Dynamic Criteria based on the precreated criteria spec $spec1 to the existing first Dynamic Member Set

of the Security Group WebApp









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-NsxSecurityGroup WebApp | Get-NsxDynamicMemberSet -Index 1 | Add-NsxDynamicCriteria -key SecurityTag

-condition equals -value "webapp"



Index SecurityGroupName SetOperator CriteriaString

----- ----------------- ----------- --------------

1 WebApp Match: ANY, VMName contains WebApp, ComputerName regex *webapp*, ENTITY

belongs_to vm-1234, SecurityTag equals webapp



Adds a new Dynamic Criteria based on the key/condition/value specified to the existing first Dynamic Member Set of

the Security Group WebApp











RELATED LINKS