Let's Do this.

  1. More specifically this.

Some Notes:

The binding for Cosmos should look like this:

{
  "bindings": [
    {
      "authLevel": "function",
      "name": "req",
      "type": "httpTrigger",
      "direction": "in",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "name": "$return",
      "type": "http",
      "direction": "out"
    },
    {
      "type": "documentDB",
      "name": "outputDocumentPortal",
      "databaseName": "outDatabasePortal",
      "collectionName": "MyCollectionPortal",
      "createIfNotExists": true,
      "connection": "organics-db_DOCUMENTDB",
      "direction": "out"
    }
  ],
  "disabled": false
}