Skip to content

Latest commit

 

History

History
243 lines (186 loc) · 6.12 KB

Set-AzureNetworkSecurityGroupAssociation.md

File metadata and controls

243 lines (186 loc) · 6.12 KB
external help file ms.assetid online version schema
Microsoft.WindowsAzure.Commands.ServiceManagement.Network.dll-Help.xml
64639A35-0573-48C8-AB21-19FEB09537BA
2.0.0

Set-AzureNetworkSecurityGroupAssociation

SYNOPSIS

Associates a network security group to a virtual machine, PaaS role, or network adapter.

[!INCLUDE rdfe-banner]

SYNTAX

AddNetworkSecurityGroupAssociationToSubnet

Set-AzureNetworkSecurityGroupAssociation -Name <String> [-Force] [-PassThru] -VirtualNetworkName <String>
 -SubnetName <String> [-Profile <AzureSMProfile>] [<CommonParameters>]

AddNetworkSecurityGroupAssociationToIaaSRole

Set-AzureNetworkSecurityGroupAssociation -Name <String> [-Force] [-PassThru] -VM <PersistentVMRoleContext>
 -ServiceName <String> [-NetworkInterfaceName <String>] [-Profile <AzureSMProfile>] [<CommonParameters>]

AddNetworkSecurityGroupAssociationToPaaSRole

Set-AzureNetworkSecurityGroupAssociation -Name <String> [-Force] [-PassThru] [-Slot <String>]
 -RoleName <String> -ServiceName <String> [-NetworkInterfaceName <String>] [-Profile <AzureSMProfile>]
 [<CommonParameters>]

DESCRIPTION

The Set-AzureNetworkSecurityGroupAssociation cmdlet associates a network security group to a virtual machine, platform as a service (PaaS) role, or network adapter.

EXAMPLES

Example 1: Assign a virtual machine to a network security group

PS C:\> Get-AzureVM -ServiceName "ContosoService" -Name "ContosoVM06" | Set-AzureNetworkSecurityGroupAssociation -Name "ContosoNetworkSecurityGroup"

This command gets a virtual machine named ContosoVM06 for the service named ContosoService, and passes that virtual machine object to the current cmdlet. The current cmdlet assigns the network security group named ContosoNetworkSecurityGroup to that virtual machine.

PARAMETERS

-Force

Forces the command to run without asking for user confirmation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

Specifies the name of the network security group that this cmdlet sets.

Type: String
Parameter Sets: (All)
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-NetworkInterfaceName

Specifies the name of the network adapter to which this cmdlet applies the network security group.

Type: String
Parameter Sets: AddNetworkSecurityGroupAssociationToIaaSRole, AddNetworkSecurityGroupAssociationToPaaSRole
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type: AzureSMProfile
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RoleName

Specifies the name of a PaaS role to which this cmdlet applies the network security group.

Type: String
Parameter Sets: AddNetworkSecurityGroupAssociationToPaaSRole
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ServiceName

Specifies the name of a cloud service. The PaaS role belongs to the service that this parameter specifies.

Type: String
Parameter Sets: AddNetworkSecurityGroupAssociationToIaaSRole, AddNetworkSecurityGroupAssociationToPaaSRole
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Slot

Specifies a PaaS slot. The PaaS role for which this cmdlet sets the network security group has the slot that this parameter specifies. Valid values are:

  • Production
  • Staging

The default value is Production.

Type: String
Parameter Sets: AddNetworkSecurityGroupAssociationToPaaSRole
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SubnetName

Specifies the name of a subnet to which this cmdlet associates the network security group.

Type: String
Parameter Sets: AddNetworkSecurityGroupAssociationToSubnet
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-VirtualNetworkName

Specifies the name of a virtual network that contains the subnet to which this cmdlet associates the network security group.

Type: String
Parameter Sets: AddNetworkSecurityGroupAssociationToSubnet
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-VM

Specifies the virtual machine to which this cmdlet applies the network security group.

Type: PersistentVMRoleContext
Parameter Sets: AddNetworkSecurityGroupAssociationToIaaSRole
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

System.Boolean

NOTES

RELATED LINKS

Get-AzureNetworkSecurityGroupAssociation

Remove-AzureNetworkSecurityGroupAssociation