We have Azure Function configured with VNet integration to our private network.
Also, we have Azure Container Instance with ClamAV application running in our private network.
Using my development machine that is connected to the private network I can connect to the ClamAV application.
But when Azure Function tries to connect to the same ClamAV application it fails with this error: Exception: An attempt was made to access a socket in a way forbidden by its access permissions. [::ffff:172.16.195.196]:3310;
The code looks like this:
var clamAvClient = new TcpClient();
await clamAvClient.ConnectAsync("172.16.195.196", 3310); // <-- exception thorwn here
// send the file data to the tcp client stream
The exact same code works from the dev machine but fails in Azure Function.
Azure Function has access to the private network (it successfully connects to the Blob Storage in this private network).
Azure Function can connect to the different ClamAV application located in the public network.