Remove-AzureNetworkSecurityGroupAssociation

Removes a network security group.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Remove-AzureNetworkSecurityGroupAssociation
      -Name <String>
      -VirtualNetworkName <String>
      -SubnetName <String>
      [-Force]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]
Remove-AzureNetworkSecurityGroupAssociation
      -Name <String>
      -VM <PersistentVMRoleContext>
      -ServiceName <String>
      [-NetworkInterfaceName <String>]
      [-Force]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]
Remove-AzureNetworkSecurityGroupAssociation
      -Name <String>
      [-Slot <String>]
      -RoleName <String>
      -ServiceName <String>
      [-NetworkInterfaceName <String>]
      [-Force]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]

Description

The Remove-AzureNetworkSecurityGroupAssociation cmdlet removes a network security group from a virtual machine.

Examples

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

PS C:\> Get-AzureVM -ServiceName "ContosoService" -Name "ContosoVM06" | Remove-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 removes the network security group named ContosoNetworkSecurityGroup from that virtual machine.

Parameters

-Force

Forces the command to run without asking for user confirmation.

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

-Name

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

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

-NetworkInterfaceName

Specifies the name of the network adapter from which this cmdlet removes the network security group.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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
Position:Named
Default value:None
Required:False
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
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RoleName

Specifies the name of a PaaS role from which this cmdlet removes the network security group.

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

-ServiceName

Specifies the name of a cloud service. The PaaS role from which this cmdlet removes a network security group belongs to the service that this parameter specifies.

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

-Slot

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

  • Production
  • Staging

The default value is Production.

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

-SubnetName

Specifies the name of a subnet from which this cmdlet removes the network security group.

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

-VirtualNetworkName

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

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

-VM

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

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

Outputs

Boolean