Azure Functions (PowerShell) : Find the current FunctionApp and Function names

I was writing an Azure Function in PowerShell. I wanted to know the name of the current FunctionApp and the current Function. Since it was a timer triggered function, I couldn’t pass the names. It took me a while to to figure this out. There may be other ways, but this only way I could find it. Again, this is in PowerShell

  $CurrentFunctionName= $($PSScriptRoot.split("/")[-1])
else {
  $CurrentFunctionName= $($PSScriptRoot.split("/")[-1])

We need a conditional is as the method is different if you are running local vs in azure.

, ,

No comments yet.

Leave a Reply