In Azure I create a Function App with Powershell Core Runtime stack:
Then I add an Http Trigger with the following code:
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request XXX."
Then I go to Code + Test, Test/Run and click the Run button.
In the Output field on the right side I see the HTTP response content.
But the Logs field at the bottom only shows
Connecting to Application Insights...
I have tried to navigating to the Logs in the left menu, but the App Service logs entry is disabled there:
This feature is not available for Function apps. Please use Application Insights.
So I try following the advice and got to the Application Insights, but can not find my trace there -
Please help me to find the trace
PowerShell HTTP trigger function processed a request XXX.
UPDATE:
I have followed the advice by Tony Ju (thanks!) and I can see some logs, but cannot find the trace line I am after yet:
You can find the logs under Monitor. Note that there will be 5 mins delay to display the logs. And it will only show the twenty most recent function invocation traces.
You can also find the logs in the application insights directly.
Update:
If you still can not find the logs there, you can try to restart your function to check if you can connect to Application Insights successfully.
Reference:
Update2:
Try to use the query as below. HttpTrigger1
is the function name.
traces
| where operation_Name == "HttpTrigger1"
| where timestamp > ago(24h)
| limit 20
Besides, restarting means restart the function app.