azurefunctioncommand-line-interface

How can I list Azure FunctionApp functions in a specific deployment slot with Azure CLI


There is a CLI method to list functions of an Azure FunctionApp (docs)

az functionapp function list -g MyResourceGroup -n MyFunctionAppName

How do I get functions deployed on a specific deployment slot?

For reference, another method - functionapp function keys list has a parameter (-s) for specifying the slot (docs).


Solution

  • ChatGPT helped me out. The method az rest can be used to retrieve the list of functions deployed on a specific deployment slot.

    az rest --method get --uri "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.Web/sites/$FUNCTION_APP/slots/$DEPLOYMENT_SLOT/functions?api-version=2018-11-01"
    

    Works like a charm. The only caveat is that when requesting production slot, you need to omit slots/$DEPLOYMENT_SLOT/ from the request.