Can't register CosmosDB binding extension in Azure Functions V2

Question

I'm trying to add a new function(Http Trigger) with CosmosDB input binding.

Reading a manual about input bindings in Azure Functions Version 2 I see that I need to register my binging extension(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#register-binding-extensions), and azure portal should show me some prompt for registration(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#azure-portal-development)

I'm confused, because I do not see in templates choice for CosmosDB input binding and therefore any of prompts. So I tried to add code manually in function.json like this:

{
  "type": "cosmosDB",
  "name": "inputDocument",
  "databaseName": "DBName",
  "collectionName": "CollectionName",
  "connectionStringSetting": "CosmosDBConnect",
  "direction": "in",
  "Id": "myid",
  "partitionKey": "mypartitionkey"
}

And when I trying to switch on my function C# code I see error "Function error(MyFuncName): The binding type(s) 'cosmosDB' are not registered. Please ensure the type is correct and the binding extension is installed."

On this page I see that CosmosDB input bindings is supported for Azure Functions Version 2(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#supported-bindings)

Solution

Update

Azure CosmosDB input/output binding template has been available, don't forget to click install.

enter image description here


You met something Azure portal may have planned to support in the future. For now there is no cosmosdb binding option for v2 function, only in v1 it's available. Have opened an issue to track this feature support.

The workaround is to Create a Cosmos DB trigger to install cosmosdb extensions(no need to create trigger actually, only use it to get installation prompt), but we still have to code manually in function.json to add bindings.

enter image description here