1

I'm trying to change the ConnectionMode of my CosmosClient to Gateway. This is my Run() function:

        public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "policy")] HttpRequest req,
         [CosmosDB( databaseName:"AR", containerName: "Policy", Connection = "CosmosConnectionString")]CosmosClient cosmos, ILogger log)

And I'm wondering, how do I change the ConnectionMode to Gateway in that part of code? Obviously something like

[CosmosDB( databaseName:"AR", containerName: "Policy", Connection = "CosmosConnectionString")]CosmosClient cosmos = new CosmosClient{ConnectionMode.Gateway}

doesn't work.

Any ideas?

nana
  • 51
  • 6

1 Answers1

0

It looks like from your code you are using the preview Webjob extension that uses the V3 SDK. The preview Webjob extension maintains the same behavior as the previous Webjob extension (3.X.X) and has Gateway as default mode. https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.CosmosDB/CosmosDBUtility.cs#L75

Matias Quaranta
  • 13,907
  • 1
  • 22
  • 47