Set-AzNetworkWatcherFlowLog

Updates flow log resource.

Syntax

Set-AzNetworkWatcherFlowLog
   -NetworkWatcherName <String>
   -ResourceGroupName <String>
   -Name <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -NetworkWatcher <PSNetworkWatcher>
   -Name <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -NetworkWatcher <PSNetworkWatcher>
   -Name <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-EnableTrafficAnalytics]
   [-TrafficAnalyticsWorkspaceId <String>]
   [-TrafficAnalyticsInterval <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -NetworkWatcherName <String>
   -ResourceGroupName <String>
   -Name <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-EnableTrafficAnalytics]
   [-TrafficAnalyticsWorkspaceId <String>]
   [-TrafficAnalyticsInterval <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -Location <String>
   -Name <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -Location <String>
   -Name <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-EnableTrafficAnalytics]
   [-TrafficAnalyticsWorkspaceId <String>]
   [-TrafficAnalyticsInterval <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -ResourceId <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -ResourceId <String>
   -TargetResourceId <String>
   -StorageId <String>
   -Enabled <Boolean>
   [-EnableRetention <Boolean>]
   [-RetentionPolicyDays <Int32>]
   [-FormatType <String>]
   [-FormatVersion <Int32>]
   [-EnableTrafficAnalytics]
   [-TrafficAnalyticsWorkspaceId <String>]
   [-TrafficAnalyticsInterval <Int32>]
   [-Tag <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzNetworkWatcherFlowLog
   -InputObject <PSFlowLogResource>
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Updates flow log resource.

Examples

Example 1

$flowLog = Get-AzNetworkWatcherFlowLog -Location eastus -Name pstest
$flowLog.Enabled = $true
$flowLog.Format.Version = 2
$flowLog | Set-AzNetworkWatcherFlowLog -Force

Name                       : pstest
Id                         : /subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/NetworkWatcherRG/provid
                             ers/Microsoft.Network/networkWatchers/NetworkWatcher_eastus/FlowLogs/pstest
Etag                       : W/"e939e1e6-1509-4d7a-9e89-1ea532f6f222"
ProvisioningState          : Succeeded
Location                   : eastus
TargetResourceId           : /subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/MyFlowLog/provide
                             rs/Microsoft.Network/networkSecurityGroups/MyNSG
StorageId                  : /subscriptions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/resourceGroups/FlowLogsV2Demo/provider
                             s/Microsoft.Storage/storageAccounts/MyStorage
Enabled                    : True
RetentionPolicy            : {
                               "Days": 0,
                               "Enabled": false
                             }
Format                     : {
                               "Type": "JSON",
                               "Version": 2
                             }
FlowAnalyticsConfiguration : {}

Example 2

Updates flow log resource. (autogenerated)

Set-AzNetworkWatcherFlowLog -Enabled $true -Name 'cert01' -NetworkWatcherName nw1 -ResourceGroupName myresourcegroup -StorageId /subscriptions/00000000-0000-0000-0000-00000000000000000/resourceGroups/FlowLogsV2Demo/providers/Microsoft.Storage/storageAccounts/MyStorage -TargetResourceId <String>

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Enabled

Flag to enable/disable flow logging.

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

-EnableRetention

Flag to enable/disable retention.

Type:Nullable<T>[Boolean]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableTrafficAnalytics

Flag to enable/disable TrafficAnalytics

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

-Force

Do not ask for confirmation if you want to overwrite a resource

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

-FormatType

The file type of flow log. The only supported value now is 'JSON'.

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

-FormatVersion

The version (revision) of the flow log.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Flow lof object.

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

-Location

Location of the network watcher.

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

-Name

The flow log name.

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

-NetworkWatcher

The network watcher resource.

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

-NetworkWatcherName

The name of network watcher.

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

-ResourceGroupName

The name of the network watcher resource group.

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

-ResourceId

FlowLog resource ID.

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

-RetentionPolicyDays

Number of days to retain flow log records.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-StorageId

ID of the storage account which is used to store the flow log.

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

-Tag

A hashtable which represents resource tags.

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

-TargetResourceId

ID of network security group to which flow log will be applied.

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

-TrafficAnalyticsInterval

The interval in minutes which would decide how frequently TA service should do flow analytics.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TrafficAnalyticsWorkspaceId

Resource Id of the attached workspace.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

Inputs

PSNetworkWatcher

String

PSFlowLogResource

Outputs

PSFlowLogResource