Get-AzNetworkSecurityGroup
Obtém um grupo de segurança de rede.
Sintaxe
Get-AzNetworkSecurityGroup
[-Name <String>]
[-ResourceGroupName <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzNetworkSecurityGroup
-Name <String>
-ResourceGroupName <String>
-ExpandResource <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
O cmdlet Get-AzNetworkSecurityGroup obtém um grupo de segurança de rede do Azure.
Exemplos
Exemplo 1: Recuperar um grupo de segurança de rede existente
Get-AzNetworkSecurityGroup -Name nsg1 -ResourceGroupName "rg1"
Name : nsg1
ResourceGroupName : rg1
Location : eastus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provider
s/Microsoft.Network/networkSecurityGroups/nsg1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
FlushConnection : False
SecurityRules : []
DefaultSecurityRules : [
{
"Name": "AllowVnetInBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound",
"Description": "Allow inbound traffic from all VMs in VNET",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"VirtualNetwork"
],
"DestinationAddressPrefix": [
"VirtualNetwork"
],
"Access": "Allow",
"Priority": 65000,
"Direction": "Inbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "AllowAzureLoadBalancerInBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBou
nd",
"Description": "Allow inbound traffic from azure load balancer",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"AzureLoadBalancer"
],
"DestinationAddressPrefix": [
"*"
],
"Access": "Allow",
"Priority": 65001,
"Direction": "Inbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "DenyAllInBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound",
"Description": "Deny all inbound traffic",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"*"
],
"DestinationAddressPrefix": [
"*"
],
"Access": "Deny",
"Priority": 65500,
"Direction": "Inbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "AllowVnetOutBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound",
"Description": "Allow outbound traffic from all VMs to all VMs in VNET",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"VirtualNetwork"
],
"DestinationAddressPrefix": [
"VirtualNetwork"
],
"Access": "Allow",
"Priority": 65000,
"Direction": "Outbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "AllowInternetOutBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound",
"Description": "Allow outbound traffic from all VMs to Internet",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"*"
],
"DestinationAddressPrefix": [
"Internet"
],
"Access": "Allow",
"Priority": 65001,
"Direction": "Outbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "DenyAllOutBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound",
"Description": "Deny all outbound traffic",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"*"
],
"DestinationAddressPrefix": [
"*"
],
"Access": "Deny",
"Priority": 65500,
"Direction": "Outbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
}
]
NetworkInterfaces : []
Subnets : []
Esse comando retorna o conteúdo do grupo de segurança de rede do Azure "nsg1" no grupo de recursos "rg1"
Exemplo 2: Listar grupos de segurança de rede existentes usando filtragem
Get-AzNetworkSecurityGroup -Name nsg*
Name : nsg1
ResourceGroupName : rg1
Location : eastus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provider
s/Microsoft.Network/networkSecurityGroups/nsg1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
FlushConnection : False
SecurityRules : []
DefaultSecurityRules : [
{
"Name": "AllowVnetInBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetInBound",
"Description": "Allow inbound traffic from all VMs in VNET",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"VirtualNetwork"
],
"DestinationAddressPrefix": [
"VirtualNetwork"
],
"Access": "Allow",
"Priority": 65000,
"Direction": "Inbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "AllowAzureLoadBalancerInBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowAzureLoadBalancerInBou
nd",
"Description": "Allow inbound traffic from azure load balancer",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"AzureLoadBalancer"
],
"DestinationAddressPrefix": [
"*"
],
"Access": "Allow",
"Priority": 65001,
"Direction": "Inbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "DenyAllInBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllInBound",
"Description": "Deny all inbound traffic",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"*"
],
"DestinationAddressPrefix": [
"*"
],
"Access": "Deny",
"Priority": 65500,
"Direction": "Inbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "AllowVnetOutBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowVnetOutBound",
"Description": "Allow outbound traffic from all VMs to all VMs in VNET",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"VirtualNetwork"
],
"DestinationAddressPrefix": [
"VirtualNetwork"
],
"Access": "Allow",
"Priority": 65000,
"Direction": "Outbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "AllowInternetOutBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/AllowInternetOutBound",
"Description": "Allow outbound traffic from all VMs to Internet",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"*"
],
"DestinationAddressPrefix": [
"Internet"
],
"Access": "Allow",
"Priority": 65001,
"Direction": "Outbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
},
{
"Name": "DenyAllOutBound",
"Etag": "W/\"00000000-0000-0000-0000-000000000000\"",
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/provide
rs/Microsoft.Network/networkSecurityGroups/nsg1/defaultSecurityRules/DenyAllOutBound",
"Description": "Deny all outbound traffic",
"Protocol": "*",
"SourcePortRange": [
"*"
],
"DestinationPortRange": [
"*"
],
"SourceAddressPrefix": [
"*"
],
"DestinationAddressPrefix": [
"*"
],
"Access": "Deny",
"Priority": 65500,
"Direction": "Outbound",
"ProvisioningState": "Succeeded",
"SourceApplicationSecurityGroups": [],
"DestinationApplicationSecurityGroups": []
}
]
NetworkInterfaces : []
Subnets : []
Esse comando retorna o conteúdo dos grupos de segurança de rede do Azure que começam com "nsg"
PARAMETERS
-DefaultProfile
As credenciais, a conta, o locatário e a assinatura usados para a comunicação com o Azure.
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExpandResource
A referência do recurso a ser expandida.
Type: System.String
Parameter Sets: Expand
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Name
Especifica o nome do grupo de segurança de rede que esse cmdlet obtém.
Type: System.String
Parameter Sets: NoExpand
Aliases: ResourceName
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
Type: System.String
Parameter Sets: Expand
Aliases: ResourceName
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
-ResourceGroupName
Especifica o nome do grupo de recursos ao qual o grupo de segurança de rede pertence.
Type: System.String
Parameter Sets: NoExpand
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
Type: System.String
Parameter Sets: Expand
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
CommonParameters
Este cmdlet oferece suporte aos parâmetros comuns: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction e -WarningVariable. Para obter mais informações, confira about_CommonParameters.
ENTRADAS
System.String
SAÍDAS
Microsoft.Azure.Commands.Network.Models.PSNetworkSecurityGroup
OBSERVAÇÕES
LINKS RELACIONADOS
PARAMETERS
-DefaultProfile
As credenciais, a conta, o locatário e a assinatura usados para a comunicação com o Azure.
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExpandResource
A referência do recurso a ser expandida.
Type: System.String
Parameter Sets: Expand
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Name
O nome do recurso.
Type: System.String
Parameter Sets: NoExpand
Aliases: ResourceName
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
Type: System.String
Parameter Sets: Expand
Aliases: ResourceName
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
-ResourceGroupName
O nome do grupo de recursos.
Type: System.String
Parameter Sets: NoExpand
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
Type: System.String
Parameter Sets: Expand
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
CommonParameters
Este cmdlet oferece suporte aos parâmetros comuns: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction e -WarningVariable. Para obter mais informações, confira about_CommonParameters.