Get-AzureNetworkSecurityGroupAssociation
Gets a network security group for a virtual machine, network adapter, or PaaS role.
Note
The cmdlets referenced in this documentation are for managing legacy Azure resources that use Service Management APIs. See the Az PowerShell module for cmdlets to manage Azure Resource Manager resources.
Syntax
Get-AzureNetworkSecurityGroupAssociation
-VirtualNetworkName <String>
-SubnetName <String>
[-Detailed]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Get-AzureNetworkSecurityGroupAssociation
-VM <PersistentVMRoleContext>
-ServiceName <String>
[-NetworkInterfaceName <String>]
[-Detailed]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Get-AzureNetworkSecurityGroupAssociation
[-Slot <String>]
-RoleName <String>
-ServiceName <String>
[-NetworkInterfaceName <String>]
[-Detailed]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Description
The Get-AzureNetworkSecurityGroupAssociation cmdlet gets the network security group for a virtual machine, network adapter, or platform as a service (PaaS) role.
Examples
Example 1: Get the network security group for a virtual machine
PS C:\> Get-AzureVM -ServiceName "ContosoService" -Name "ContosoVM06" | Get-AzureNetworkSecurityGroupAssociation
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 gets the network security group associated to that virtual machine.
Parameters
-Detailed
Indicates that this cmdlet returns details of the network security group that is associated to the virtual machine. These details include location and rules.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NetworkInterfaceName
Specifies the name of the network adapter for which this cmdlet gets the network security group.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
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 for which this cmdlet gets 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 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 for which this cmdlet gets the 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 for which this cmdlet gets 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 for which this cmdlet gets 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
Microsoft.WindowsAzure.Commands.ServiceManagement.Network.NetworkSecurityGroup.Model.INetworkSecurityGroup