Hello @Radouane Garoiaz ,

Greetings! Welcome to Microsoft Q&A forum! Thank you posting the question. Could you please provide more details to the issue? Are you trying to push data from an Azure IoT Edge module to Azure IoT Hub?
Can you share any articles/tutorials you have followed or referenced in developing the solution?

I have tried to look up the error and came across this GitHub issue which reports the same error. Here is one of the troubleshooting steps mentioned in the GitHub

Can you please confirm if the OPC client complies with Basic256Sha256 security policy and message security mode Sign & Encrypt to connect.

Hello @LeelaRajeshSayana-MSFT ,
Yes I'm trying to push data from an Azure IoT Edge module to Azure IoT Hub, I didn't follow an articles/tutorials because the project was already exist and was working fine since last week.

OPC server and client have a none security Policy (SecurityPolicy.None and MessageSecurityMode.None)

InAddition to the suggestions provided on the Github issue, please try the below initial troubleshooting steps!

The error message "Failed to create session 'session_id' due to One or more errors occurred. (Error establishing a connection: BadNotConnected)" indicates that there is a problem with the connection between the OPC UA server and the OPC UA client.

Here are some things you can try to resolve the issue:

  • Check the network connectivity between the OPC UA server and the OPC UA client. Make sure that both the server and the client are on the same network and that there are no firewall or network restrictions that could be blocking the connection.
  • Verify that the OPC UA server is running and is accessible. You can do this by using an OPC UA client tool such as UA Expert or UaGateway to connect to the server and browse its address space.
  • Check the OPC UA client configuration in your Azure IoT Edge module. Make sure that the endpoint URL, security policy, and message security mode are all set correctly and match the configuration of the OPC UA server. You can also try specifying the session timeout and the keep-alive interval to see if it helps.
  • Check the OPC UA server logs for any errors or warnings that could indicate the cause of the problem.
  • Try restarting the OPC UA server and the Azure IoT Edge module to see if it resolves the issue.
  • Please comment in the below section if you are still facing the same issue and we are more than happy to help you!