How can I receive TCP messages using Azure Functions or Logic Apps?

Muhammad Zubair 30 Reputation points
2024-08-02T03:56:10.7333333+00:00

Hi, I'm looking to receive TCP messages using Azure Functions or Logic Apps. I understand that both services are typically triggered by HTTP requests, but I'm wondering if there's a way to run a TCP receiver app within an Azure Function to accept TCP messages. Additionally, I haven't found any networking settings in Azure Functions that allow TCP traffic. Is there a workaround or a configuration option to enable TCP support in Azure Functions or Logic Apps?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,890 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,087 questions
Azure Health Data Services
Azure Health Data Services
An Azure offering that provides a suite of purpose-built technologies for protected health information in the cloud.
160 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ryan Hill 27,771 Reputation points Microsoft Employee
    2024-08-06T02:22:51.1666667+00:00

    Hi @Muhammad Zubair

    Due to the network restrictions, you can't listen for TCP requests unless they're being received over ports 80 or 443.

    I did see mentions of HL7 and FHIR, so one thing you can look at utilizing is What is Azure Health Data Services? | Microsoft Learn or What is Azure API for FHIR? - Azure API for FHIR | Microsoft Learn. These services are more aligned to working with health data. However, if it isn't health data you're really looking at, then the best option to listen for specific TCP messages would be to utilize an Azure Virtual Machine configured to listen for those messages and your custom python code to process them.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Sina Salam 10,036 Reputation points
    2024-08-02T05:31:00.44+00:00

    Hello Muhammad Zubair,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    I understand that you would like to configure or program networking settings in Azure Functions that allow TCP traffic.

    Solution

    Azure Functions and Logic Apps are primarily designed for HTTP-triggered workflows, there are some considerations regarding TCP support:

    1. You can use Hybrid Connections to enable TCP tunneling. It allows your function to connect to on-premises resources via a secure channel. You can set up a Hybrid Connection to listen for TCP messages and relay them to your function. https://stackoverflow.com/questions/73568530/share-app-service-plan-between-logic-apps-and-azure-app-functions.
    2. Another option is to use Durable Functions, which provide more flexibility. You can create custom logic within a Durable Function to handle TCP communication. https://stackoverflow.com/questions/78823717/how-can-i-receive-tcp-messages-using-azure-functions-or-logic-apps
    3. Lastly, in the case of logic app. You can use Azure Virtual Network (VNET) Integration or App Service Environment (ASE) to access on-premises resources via TCP. By connecting your Logic App to a VNET or ASE, you can route traffic to internal endpoints. https://stackoverflow.com/questions/73568530/share-app-service-plan-between-logic-apps-and-azure-app-functions .

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam


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.