Can't connect to cosmosdb from function when I deploy to Azure but it works locally

Jason Taylor 1 Reputation point
2021-11-22T01:02:56.6+00:00

I have a function deployed in a functionapp that accesses a cosmosdb to write some data. My function works locally but when I deploy to Azure I keep getting an error that states:
No connection adapters were found for <DB_URI>

I'm using python and am creating the CosmosClient using the DB_URI and the Account_Primary_Key which I'm fetching from a key vault.

For some reason it works when I run locally passing the same parameters through env variables via local.settings.json but throws this error when pushed to the cloud.

Anyone have any pointers? The FunctionApp has rights to read the key vault as well as db contributor role access. The error message isn't helping me find the root cause.
Thanks,
Jason

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,679 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,543 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,016 Reputation points
    2021-11-22T08:55:15.513+00:00

    @Jason Taylor Can you please confirm if your DB_URI has https:// as this could cause the error : No connection adapters were found for <DB_URI>