1

I am working on an Azure cloud project where we are using Azure Functions (the code is written in Python). We would like to see our app execution logs, but our client, out of security concerns, will not give access to most Azure Portal features (including log stream for Azure Functions). We do have a service principal with which we can execute commands using the azure cli.

My question is whether there is some way to view our app execution logs using said service principal and the azure cli, even if we cannot view the logs in real time (and if so, how).

Thanks so much in advance!

MrMuppet
  • 547
  • 1
  • 4
  • 12

1 Answers1

1

If the Log Stream is what you're looking for, you can Enable streaming execution logs in Azure Functions and connect to them using the Core tools, Azure CLI or Azure PowerShell.

Using the Core tools, for example, you can run:

func azure functionapp logstream <FunctionAppName>

which

Connects the local command prompt to streaming logs for the function app in Azure.

func azure functionapp logstream <APP_NAME>

The default timeout for the connection is 2 hours. You can change the timeout by adding an app setting named SCM_LOGSTREAM_TIMEOUT, with a timeout value in seconds.

Taken from func azure functionapp logstream

rickvdbosch
  • 14,105
  • 2
  • 40
  • 53
  • 1
    The problem with that is that my function is written in Python, which is only supported on a Linux based hosting plan, and Log stream is not currently supported in Linux Consumption Apps. – MrMuppet Sep 06 '21 at 11:52