Unable to connect to Azure CosmosDB (MongoDB) from Azure "API APP on windows"

I am using VSTS for auto build and release. With the same configuration I am able to perform integration testing (involves CRUD operations on Azure CosmosDB) in my build.
However, when my application is deployed in to the Azure API APP, my application is not connecting to the Azure CosmosDB.
What could be the issue?