skip to Main Content

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).

2

Answers


  1. Chosen as BEST ANSWER

    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.


  2. By default az functionapp list command does not contain --slot parameter to filter the function apps by slots.

    Refer this MS document:-
    az functionapp | Microsoft Learn

    I added one Function app in staging slot and ran the below alternatives to fetch the same deployment slots for specific function app via default hostname.

    As an alternative you can try the below command.

    Code:-

    az functionapp show --name MyFunctionapp --resource-group MyResourceGroup --slot staging
    

    Output- Hostname is allocated to staging slot like below:-

    enter image description here

    enter image description here

    To get the specific function app with its slot.
    You can also use the command below:-

    Code:-

     az functionapp deployment slot list --name MyFunctionapp --resource-group MyResourceGroup
    

    Output- Hostname is allocated to staging slot like below:-

    enter image description here

    enter image description here

    I tried running az functionapp function list and did not receive any slot property also the command does not contain --slot parameter as Deployment slots are added at the Function app level that is app service plan level to manage the application deployment and not its dependent functions like the HTTP or queued triggers at functions level.

    Refer here :-
    az functionapp function | Microsoft Learn

    Code:-

    az functionapp function list -g MyResourceGroup -n MyFunctionAppName
    

    Output:-

    enter image description here

    enter image description here

    Even az functionapp function show does not contain --slot parameter or slot property in the output.

    Code:-

    az functionapp function show -g MyResourceGroup -n MyFunctionAppName --function-name MyFunctionName
    

    Output:-

    enter image description here

    enter image description here

    References:-

    az functionapp deployment slot | Microsoft Learn

    az functionapp function | Microsoft Learn

    az functionapp function | Microsoft Learn

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search