How to terminate Durable Function instance hosted in a container app in a VNet?

Laoura Gkogka 20 Reputation points
2025-02-17T12:33:43.8933333+00:00

I have an Azure Durable Function running inside an Azure Container App that is deployed within a VNet. I need to stop or terminate instances of this function, but I am unsure of the best approach, considering the networking constraints.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,437 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,645 questions
Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
544 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Khadeer Ali 3,510 Reputation points Microsoft Vendor
    2025-02-18T11:50:57.55+00:00

    @Laoura Gkogka ,

    Since your Durable Function is running in an Azure Container App inside a VNet, the 401 error might be due to authentication or network restrictions.

    Authentication – Managed Identity: Make sure your Managed Identity (msi-salil-test) has the right permissions, like "Azure Container Apps Service Contributor" and "Storage Queue Data Contributor". You can check its permissions with this command:

    az role assignment list --assignee <MANAGED_IDENTITY_CLIENT_ID>

    If you're using MSI, try getting an access token and passing it in your request:

    ACCESS_TOKEN=$(az account get-access-token --resource https://management.azure.com --query accessToken --output tsv)

    curl -i -X POST "<terminatePostUri>" -H "Authorization: Bearer $ACCESS_TOKEN"

    Network Access: Since your function is inside a VNet, make sure your jumphost can reach the Container App. Run nslookup from the jumphost to check DNS resolution. Also, ensure that Private Endpoints and Firewall Rules allow traffic from the jumphost to the Container App.

    Last option -Set to Anonymous: If you're still getting a 401 error, you can temporarily set authentication to Anonymous in the Azure Portal. Go to Container Apps → Authentication → Change to Anonymous. If this works, then it's definitely an authentication issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.