4

I've created and successfully tested a Function App that requires the .net Framework because of a legacy library, and is set to use run-time version ~1. I'm looking for the Invoke Url and code, to help automate deployment.

Following this MS article and using the azure-functions-core-tools v2 (npm i -g azure-functions-core-tools@^2), I can see the Invoke Url when publish is called with the --verbose option.

However, because of the .net Framework requirement and run-time version ~1, we're bound to azure-functions-core-tools v1 (npm i -g azure-functions-core-tools@^1) (see here). Executing any of the commands from func azure functionapp does’t include the Invoke Url. The --verbose option is not available.

>func azure functionapp publish <MyApp>

Getting site publishing info...
Publish C:\<MyProject> contents to an Azure Function App. Locally deleted files are not removed from destination.
Creating archive for current directory...
Uploading archive...
Upload completed successfully.

Same for list-functions

>func azure functionapp list-functions <MyApp>

Functions in <MyApp>:
    FunctionOne - [httpTrigger]
    FunctionTwo - [httpTrigger]

I haven't tried ARM yet.

Is there a way to obtain the Invoke Url for Function Apps on run-time version ~1?

Case 303
  • 538
  • 10
  • 24

3 Answers3

2

I get the Invoke Url and the code with the following Azure CLI commands:

FUNCTION_CODE=$(az functionapp function keys list -g ${SOLUTION_NAME} -n $FUNCTIONS_NAME --function-name DPSCustomAllocationFunction --query "default")
FUNCTION_CODE=$(echo "$FUNCTION_CODE" | tr -d '"') #Remove "" from result
FUNCTION_URL=$(az functionapp function show --function-name DPSCustomAllocationFunction --resource-group $SOLUTION_NAME --query "invokeUrlTemplate" --output tsv --name $FUNCTIONS_NAME)
FUNCTION_URL=$(echo $FUNCTION_URL|tr -d '\r\n') #Remove breaklines from result
INVOKE_FUNCTION="$FUNCTION_URL?code=$FUNCTION_CODE"
kevin
  • 988
  • 12
  • 23
1

Yo could use the REST API to get it:List Function Secrets, it will response the secret and triggerUrl.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets?api-version=2016-08-01

Also you could implement it with the PowerShell GetFunctionInvokeUrl to do it.

George Chen
  • 13,703
  • 2
  • 11
  • 26
  • sorry haven't had a chance to test yet. will update ASAP. – Case 303 May 22 '19 at 17:14
  • sorry for the late reply. I haven't come back to this ticket for a while. Currently I can't call ARM, I don't have the credentials to access our corporate subscription.. – Case 303 Jul 11 '19 at 19:43
  • Worth noting that `listsecrets` will not work by default with runtime V2. It will if you change the storage type for secrets to `file`, but you shouldn't. Use `listkeys` and API version `2018-11-01` for V2 runtime now that the API actually supports retrieving keys from blob storage. – Steve Pettifer Nov 12 '19 at 09:55
1

You can do this with Azure CLI:

az functionapp function show

az functionapp function show --function-name MyFunction --name MyApp --resource-group MyResourceGroup --query "invokeUrlTemplate" --output tsv
Markus Meyer
  • 3,327
  • 10
  • 22
  • 35