FSharp.CosmosDb icon indicating copy to clipboard operation
FSharp.CosmosDb copied to clipboard

Feature req: identity-based connection

Open kumkee opened this issue 1 year ago • 6 comments

Do you only support Connection-String connections?

Please add support for identity-based connection.

In the upstream, this is done using the DefaultAzureCredential class provided by the Azure.Identity client library.

This would be a function called Cosmos.fromCredential which works like

open Microsoft.Azure.Cosmos
open Azure.Identity
open FSharp.CosmosDb

let credential = new DefaultAzureCredential()

let insertUsers data =
    credential 
    |> Cosmos.fromCredential
    |> Cosmos.database "UserDb"
    |> Cosmos.container "UserContainer"
    |> Cosmos.insertMany<User> data
    |> Cosmos.execAsync

Many thanks.

kumkee avatar Nov 29 '23 17:11 kumkee