question

GnanasekarMDasarathan-8807 avatar image
0 Votes"
GnanasekarMDasarathan-8807 asked stan answered

How to automate packet capture ( Network Watcher)?

hi All,

I followed the document https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-alert-triggered-packet-capture

When I would like to 'Add PowerShell to the function' in that document, I'm getting below error

  1. I've replaced the relevant fields in the Powershell code and clicked 'Test/Run' and throws me below error

2021-10-22T07:28:59.636 [Error] Executed 'Functions.AlertPacketCapturePowershell' (Failed, Id=9ef9f06e-9f04-4175-8889-d7da57322bfc, Duration=2ms)Result: FailureException: No parameter defined in the script or function for the input binding 'Request'.Stack: at Microsoft.Azure.Functions.PowerShellWorker.AzFunctionInfo..ctor(RpcFunctionMetadata metadata) in /home/vsts/work/1/s/src/FunctionInfo.cs:line 131at Microsoft.Azure.Functions.PowerShellWorker.FunctionLoader.LoadFunction(FunctionLoadRequest request) in /home/vsts/work/1/s/src/FunctionLoader.cs:line 52at Microsoft.Azure.Functions.PowerShellWorker.RequestProcessor.ProcessFunctionLoadRequest(StreamingMessage request) in /home/vsts/work/1/s/src/RequestProcessor.cs:line 222

I googled and observed few are suggested to decrease the run -time version to V1 from V3. I did it so [ not sure it's the right approach] and still getting below error

2021-10-22T07:37:44.761 [Error] Import-Module : Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.at <ScriptBlock>, /AlertPacketCapturePowershell/azuremodules/Az.Accounts/Az.Accounts.psm1: line 117 at run.ps1: line 4+ Import-Module+ + CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
2021-10-22T07:37:46.386 [Error] Connect-AzAccount : The term 'Connect-AzAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.at run.ps1: line 31+ Connect-AzAccount+
+ CategoryInfo : ObjectNotFound: (Connect-AzAccount:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException
2021-10-22T07:37:46.417 [Error] Exception while executing function: Functions.AlertPacketCapturePowershell. Microsoft.Azure.WebJobs.Script: PowerShell script error. Microsoft.Azure.PowerShell.Authentication: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
2021-10-22T07:37:46.433 [Error] Function completed (Failure, Id=1881dcb2-012d-44ae-897c-31e68a606d8b, Duration=2459ms)
Any help is appreciated. Thanks in advance

Thanks,
Gnanasekar

azure-network-watcher
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

stan avatar image
0 Votes"
stan answered

Hi,
I would suggest to open GitHub issue for that specific document and report that the example is no longer working.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.