Last active
July 24, 2018 15:58
-
-
Save kongou-ae/e751c032fe8f0cb0fa901a0d756e5f62 to your computer and use it in GitHub Desktop.
Set-AzureRmNetworkWatcherConfigFlowLog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Region = "westus2" | |
$NsgName = "vyos-nsg" | |
$NsgRsgName = "virtualwan" | |
$LogstorageRsgName = "azs" | |
$LogStorageName = "azsdiag457" | |
$NetworkWatcherName = "NetworkWatcher_" + $Region | |
$NW = Get-AzurermNetworkWatcher -ResourceGroupName NetworkWatcherRG -Name $NetworkWatcherName | |
$nsg = Get-AzureRmNetworkSecurityGroup -ResourceGroupName $NsgRsgName -Name $NsgName | |
$storageAccount = Get-AzureRmStorageAccount -ResourceGroupName $LogstorageRsgName -Name $LogStorageName | |
$res = Get-AzureRmNetworkWatcherFlowLogStatus -NetworkWatcher $NW -TargetResourceId $nsg.Id | |
if ( $res.Enabled -eq $false ){ | |
Set-AzureRmNetworkWatcherConfigFlowLog -NetworkWatcher $NW -TargetResourceId $nsg.Id ` | |
-StorageAccountId $storageAccount.Id -EnableFlowLog $true ` | |
-EnableRetention $True -RetentionInDays 365 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment