# Azure serverless and Cosmodb

**URL:** https://forum.serverless.com/t/azure-serverless-and-cosmodb/11484
**Category:** Serverless Framework
**Tags:** azure
**Created:** [May 19, 2020, 7:55am UTC](https://forum.serverless.com/t/azure-serverless-and-cosmodb/11484 "2020-05-19T07:55:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ludo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/ludo/32/4253_2.png) [@ludo](https://forum.serverless.com/u/ludo)
#### Post date: [May 19, 2020, 7:55am UTC](https://forum.serverless.com/t/azure-serverless-and-cosmodb/11484/1 "2020-05-19T07:55:15Z")

</div>

Hi,  
I have to do some stuff with cosmodb from my functions.  
How can i set the cosmodb connection ? inside the serverless.yml ?  
I can’t find anything about that inside the documentation.  
Can you help me ?

---

<div class="post-metadata">

### Author: ![ludo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/ludo/32/4253_2.png) [@ludo](https://forum.serverless.com/u/ludo)
#### Post date: [May 19, 2020, 12:06pm UTC](https://forum.serverless.com/t/azure-serverless-and-cosmodb/11484/2 "2020-05-19T12:06:52Z")

</div>

I found this page

> **[Serverless Framework - Azure Functions Events - Cosmos DB](https://www.serverless.com/framework/docs/providers/azure/events/cosmosdb/)**
>
> Setting up Cosmos DB Events with Azure Functions via the Serverless Framework

But when i try Serverless plugin “cosmosDB” not found. Make sure it’s installed and listed in the “plugins” section of your serverless config file.

---

<div class="post-metadata">

### Author: ![ardasendur](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/ardasendur/32/4553_2.png) [@ardasendur](https://forum.serverless.com/u/ardasendur)
#### Post date: [May 29, 2020, 1:17pm UTC](https://forum.serverless.com/t/azure-serverless-and-cosmodb/11484/3 "2020-05-29T13:17:56Z")

</div>

I have encountered same issue. I want to create cosmos DB with serverless framework. However, it seems not possible. I have found this source

> <https://stackoverflow.com/questions/49248164/using-serverless-framework-how-to-setup-a-azure-cosmosdb-in-yml-file/49266455#49266455>

  
. Did you solve the problem?

---

<div class="post-metadata">

### Author: ![blomm](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/blomm/32/3830_2.png) [@blomm](https://forum.serverless.com/u/blomm)
#### Post date: [October 27, 2020, 6:50am UTC](https://forum.serverless.com/t/azure-serverless-and-cosmodb/11484/4 "2020-10-27T06:50:08Z")

</div>

> [@ardasendur](#):
>
> Using serverless framework, how to setup a Azure CosmosDB in yml file?

It still seems not possible.  
I’ve installed the serverless-azure-functions and tried to create the yml configuration, but still having issues, I’ve logged a bug here if anyone can help?

> <https://github.com/serverless/serverless-azure-functions/issues/507>
>
> \<!--
> 1. Please check if an issue already exists. This bug may have already been… documented
> 2. Check out and follow our Guidelines: https://github.com/serverless/serverless-azure-functions/CONTRIBUTING.md
> 3. Fill out the whole template so we have a good overview on the issue
> 4. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the Issue
> 5. Please follow the template, otherwise we'll have to ask you to update it
> \--\>
> 
> \# This is a Bug Report
> 
> \## Description
> 
> \- What went wrong? : when running sls offline or sls deploy, this error pops up
> \- What did you expect should have happened? publish to azure with a function that allows me to read/write with cosmosDB
> \- What was the config you used? (pretty much straight from \[the docs\](https://www.serverless.com/framework/docs/providers/azure/events/cosmosdb/))
> 
> \`\`\`
> functions:
> sampleQuery:
> handler: src/handlers/sample.query
> events:
> - http: true
> methods:
> - POST
> authLevel: anonymous
> - cosmosDB:
> direction: out
> name: record # name of input parameter in function signature
> databaseName: sampleDB
> collectionName: sampleCollection
> connectionStringSetting: COSMOS\_DB\_CONNECTION # name of appsetting with the connection string
> createIfNotExists: true # A boolean value to indicate whether the collection is created when it doesn't exist.
> \`\`\`
>   
> 
> \- What stacktrace or error message from your provider did you see?
> Error: Binding direction not supported
> at Function. (/Users/michaelblom/development/nanook/reporting-config-api/node\_modules/serverless-azure-functions/lib/shared/utils.js:99:39)
> 
> Similar or dependent issues:
> 
> !\[image\](https://user-images.githubusercontent.com/364940/97196555-83e79600-17a4-11eb-8e65-bcec667ce7ef.png)
> 
> \- I thought it a bit strange that the error message has 2 spaces between Binding and direction, so i've play around with the indentation a bit, but that didn't fix anything.
> 
> \## Additional Data
> 
> Your Environment Information ---------------------------
> Operating System: darwin
> Node Version: 10.16.0
> Framework Version: 2.8.0
> Plugin Version: 4.1.1
> SDK Version: 2.3.2
> Components Version: 3.2.7
> 
> \- \*\*\_Provider Error messages\_\*\*:
> Error: Binding direction not supported
> at Function.\<anonymous\> (/Users/michaelblom/development/nanook/reporting-config-api/node\_modules/serverless-azure-functions/lib/shared/utils.js:99:39)
