< Back
New-NsxSecurityTagAssignment
Post
NAME New-NsxSecurityTagAssignment
SYNOPSIS
This cmdlet assigns is used to assign NSX Security Tags to a virtual machine.
SYNTAX
New-NsxSecurityTagAssignment -VirtualMachine <VirtualMachineInterop[]> [-SecurityTag] <XmlElement[]> -ApplyTag
[-Connection <PSObject>] [<CommonParameters>]
New-NsxSecurityTagAssignment [-VirtualMachine] <VirtualMachineInterop[]> -SecurityTag <XmlElement[]> -ApplyToVm
[-Connection <PSObject>] [<CommonParameters>]
DESCRIPTION
A NSX Security Tag is an arbitrary string. It is used in other functions of
NSX such as Security Groups match criteria. Security Tags are applied to a
Virtual Machine.
This cmdlet is used to assign NSX Security Tags to a virtual machine.
PARAMETERS
-VirtualMachine <VirtualMachineInterop[]>
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-SecurityTag <XmlElement[]>
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ApplyTag [<SwitchParameter>]
Required? true
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-ApplyToVm [<SwitchParameter>]
Required? true
Position? named
Default value False
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-VM Web-01 | New-NsxSecurityTagAssignment -ApplyTag -SecurityTag (Get-NsxSecurityTag ST-Web-DMZ)
Assign a single security tag to a virtual machine
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-NsxSecurityTag ST-Web-DMZ | New-NsxSecurityTagAssignment -ApplyToVm -VirtualMachine (Get-VM Web-01)
Assign a single security tag to a virtual machine
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-VM Web-01 | New-NsxSecurityTagAssignment -ApplyTag -SecurityTag $( Get-NsxSecurityTag | where-object
{$_.name -like "*prod*"} )
Assign all security tags containing "prod" in the name to a virtual machine
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-NsxSecurityTag | where-object { $_.name -like "*dmz*" } | New-NsxSecurityTagAssignment -ApplyToVm
-VirtualMachine (Get-VM web01,app01,db01)
Assign all security tags containing "DMZ" in the name to multiple virtual machines
RELATED LINKS
SYNOPSIS
This cmdlet assigns is used to assign NSX Security Tags to a virtual machine.
SYNTAX
New-NsxSecurityTagAssignment -VirtualMachine <VirtualMachineInterop[]> [-SecurityTag] <XmlElement[]> -ApplyTag
[-Connection <PSObject>] [<CommonParameters>]
New-NsxSecurityTagAssignment [-VirtualMachine] <VirtualMachineInterop[]> -SecurityTag <XmlElement[]> -ApplyToVm
[-Connection <PSObject>] [<CommonParameters>]
DESCRIPTION
A NSX Security Tag is an arbitrary string. It is used in other functions of
NSX such as Security Groups match criteria. Security Tags are applied to a
Virtual Machine.
This cmdlet is used to assign NSX Security Tags to a virtual machine.
PARAMETERS
-VirtualMachine <VirtualMachineInterop[]>
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-SecurityTag <XmlElement[]>
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ApplyTag [<SwitchParameter>]
Required? true
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-ApplyToVm [<SwitchParameter>]
Required? true
Position? named
Default value False
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-VM Web-01 | New-NsxSecurityTagAssignment -ApplyTag -SecurityTag (Get-NsxSecurityTag ST-Web-DMZ)
Assign a single security tag to a virtual machine
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-NsxSecurityTag ST-Web-DMZ | New-NsxSecurityTagAssignment -ApplyToVm -VirtualMachine (Get-VM Web-01)
Assign a single security tag to a virtual machine
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-VM Web-01 | New-NsxSecurityTagAssignment -ApplyTag -SecurityTag $( Get-NsxSecurityTag | where-object
{$_.name -like "*prod*"} )
Assign all security tags containing "prod" in the name to a virtual machine
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-NsxSecurityTag | where-object { $_.name -like "*dmz*" } | New-NsxSecurityTagAssignment -ApplyToVm
-VirtualMachine (Get-VM web01,app01,db01)
Assign all security tags containing "DMZ" in the name to multiple virtual machines
RELATED LINKS