< Back
Set-AzureRmNetworkWatcherConfigFlowLog
Post
NAME Set-AzureRmNetworkWatcherConfigFlowLog
SYNOPSIS
Configures flow logging for a target resource.
SYNTAX
Set-AzureRmNetworkWatcherConfigFlowLog [-AsJob] [-DefaultProfile <IAzureContextContainer>] -EnableFlowLog <Boolean> [-EnableRetention <Boolean>]
-NetworkWatcher <PSNetworkWatcher> [-RetentionInDays <Int32>] -StorageAccountId <String> -TargetResourceId <String> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-AzureRmNetworkWatcherConfigFlowLog [-AsJob] [-DefaultProfile <IAzureContextContainer>] -EnableFlowLog <Boolean> [-EnableRetention <Boolean>]
-NetworkWatcherName <String> -ResourceGroupName <String> [-RetentionInDays <Int32>] -StorageAccountId <String> -TargetResourceId <String>
[-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-AzureRmNetworkWatcherConfigFlowLog configures flow logging for a target resource. Properties to configure include: whether or not flow
logging is enabled for the resource provided, the configured storage account to send logs, and the retention policy for the logs. Currently
Network Security Groups are supported for flow logging.
PARAMETERS
-AsJob [<SwitchParameter>]
Run cmdlet in the background
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-EnableFlowLog <Boolean>
Flag to enable/disable flow logging.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-EnableRetention <Boolean>
Flag to enable/disable retention.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-NetworkWatcher <PSNetworkWatcher>
The network watcher resource.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-NetworkWatcherName <String>
The name of network watcher.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-ResourceGroupName <String>
The name of the network watcher resource group.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-RetentionInDays <Int32>
Number of days to retain flow log records.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-StorageAccountId <String>
ID of the storage account which is used to store the flow log.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-TargetResourceId <String>
The target resource ID.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
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 (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
Microsoft.Azure.Commands.Network.Models.PSNetworkWatcher
System.String System.Boolean System.Int32
OUTPUTS
Microsoft.Azure.Commands.Network.Models.PSFlowLog
NOTES
Keywords: azure, azurerm, arm, resource, management, manager, network, networking, watcher, flow, logs, flowlog, logging
--- Example 1: Configure Flow Logging for a Specified NSG ---
PS C:\\> $NW = Get-AzurermNetworkWatcher -ResourceGroupName NetworkWatcherRg -Name NetworkWatcher_westcentralus
PS C:\\> $nsg = Get-AzureRmNetworkSecurityGroup -ResourceGroupName NSGRG -Name appNSG
PS C:\\> $storageId =
"/subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/NSGRG/providers/Microsoft.Storage/storageAccounts/contosostorageacct123"
PS C:\\> Set-AzureRmNetworkWatcherConfigFlowLog -NetworkWatcher $NW -TargetResourceId $nsg.Id -EnableFlowLog $true -StorageAccountId $storageID
TargetResourceId :
/subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/NSGRG/providers/Microsoft.Network/networkSecurityGroups/appNSG
StorageId :
/subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/NSGRG/providers/Microsoft.Storage/storageAccounts/contosostorageacct123
Enabled : True
RetentionPolicy : {
"Days": 0,
"Enabled": false
}
In this example we configure flow logging status for a Network Security Group. In the response, we see the specified NSG has flow logging enabled,
and no retention policy set.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... figflowlog
Get-AzureRmNetworkWatcherFlowLogStatus
New-AzureRmNetworkWatcher
Get-AzureRmNetworkWatcher
Remove-AzureRmNetworkWatcher
New-AzureRmNetworkWatcherPacketCapture
New-AzureRmPacketCaptureFilterConfig
Get-AzureRmNetworkWatcherPacketCapture
Remove-AzureRmNetworkWatcherPacketCapture
Stop-AzureRmNetworkWatcherPacketCapture
Test-AzureRmNetworkWatcherIPFlow
Get-AzureRmNetworkWatcherNextHop
Get-AzureRmNetworkWatcherSecurityGroupView
Get-AzureRmNetworkWatcherTopology
Start-AzureRmNetworkWatcherResourceTroubleshooting
Get-AzureRmNetworkWatcherTroubleshootingResult
SYNOPSIS
Configures flow logging for a target resource.
SYNTAX
Set-AzureRmNetworkWatcherConfigFlowLog [-AsJob] [-DefaultProfile <IAzureContextContainer>] -EnableFlowLog <Boolean> [-EnableRetention <Boolean>]
-NetworkWatcher <PSNetworkWatcher> [-RetentionInDays <Int32>] -StorageAccountId <String> -TargetResourceId <String> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-AzureRmNetworkWatcherConfigFlowLog [-AsJob] [-DefaultProfile <IAzureContextContainer>] -EnableFlowLog <Boolean> [-EnableRetention <Boolean>]
-NetworkWatcherName <String> -ResourceGroupName <String> [-RetentionInDays <Int32>] -StorageAccountId <String> -TargetResourceId <String>
[-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-AzureRmNetworkWatcherConfigFlowLog configures flow logging for a target resource. Properties to configure include: whether or not flow
logging is enabled for the resource provided, the configured storage account to send logs, and the retention policy for the logs. Currently
Network Security Groups are supported for flow logging.
PARAMETERS
-AsJob [<SwitchParameter>]
Run cmdlet in the background
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-EnableFlowLog <Boolean>
Flag to enable/disable flow logging.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-EnableRetention <Boolean>
Flag to enable/disable retention.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-NetworkWatcher <PSNetworkWatcher>
The network watcher resource.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-NetworkWatcherName <String>
The name of network watcher.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-ResourceGroupName <String>
The name of the network watcher resource group.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-RetentionInDays <Int32>
Number of days to retain flow log records.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-StorageAccountId <String>
ID of the storage account which is used to store the flow log.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-TargetResourceId <String>
The target resource ID.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
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 (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
Microsoft.Azure.Commands.Network.Models.PSNetworkWatcher
System.String System.Boolean System.Int32
OUTPUTS
Microsoft.Azure.Commands.Network.Models.PSFlowLog
NOTES
Keywords: azure, azurerm, arm, resource, management, manager, network, networking, watcher, flow, logs, flowlog, logging
--- Example 1: Configure Flow Logging for a Specified NSG ---
PS C:\\> $NW = Get-AzurermNetworkWatcher -ResourceGroupName NetworkWatcherRg -Name NetworkWatcher_westcentralus
PS C:\\> $nsg = Get-AzureRmNetworkSecurityGroup -ResourceGroupName NSGRG -Name appNSG
PS C:\\> $storageId =
"/subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/NSGRG/providers/Microsoft.Storage/storageAccounts/contosostorageacct123"
PS C:\\> Set-AzureRmNetworkWatcherConfigFlowLog -NetworkWatcher $NW -TargetResourceId $nsg.Id -EnableFlowLog $true -StorageAccountId $storageID
TargetResourceId :
/subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/NSGRG/providers/Microsoft.Network/networkSecurityGroups/appNSG
StorageId :
/subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/NSGRG/providers/Microsoft.Storage/storageAccounts/contosostorageacct123
Enabled : True
RetentionPolicy : {
"Days": 0,
"Enabled": false
}
In this example we configure flow logging status for a Network Security Group. In the response, we see the specified NSG has flow logging enabled,
and no retention policy set.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... figflowlog
Get-AzureRmNetworkWatcherFlowLogStatus
New-AzureRmNetworkWatcher
Get-AzureRmNetworkWatcher
Remove-AzureRmNetworkWatcher
New-AzureRmNetworkWatcherPacketCapture
New-AzureRmPacketCaptureFilterConfig
Get-AzureRmNetworkWatcherPacketCapture
Remove-AzureRmNetworkWatcherPacketCapture
Stop-AzureRmNetworkWatcherPacketCapture
Test-AzureRmNetworkWatcherIPFlow
Get-AzureRmNetworkWatcherNextHop
Get-AzureRmNetworkWatcherSecurityGroupView
Get-AzureRmNetworkWatcherTopology
Start-AzureRmNetworkWatcherResourceTroubleshooting
Get-AzureRmNetworkWatcherTroubleshootingResult