VinSmile
VinSmile

Reputation: 756

Connect to Cosmos DB account using Azure Managed Service Identity

Is it possible to connect to Azure cosmos DB using MSI the same way as it is possible for Azure SQL?

That's how it works for Azure SQL Server

using (var connection = new SqlConnection(connectionString))
{
    connection.AccessToken = await new AzureServiceTokenProvider().GetAccessTokenAsync("https://database.windows.net/");
    await connection.OpenAsync(cancellationToken);

    //...
}

I'm not able to find anythig like this for Cosmos DB. While MSI support for it seems to be enabled

Upvotes: 2

Views: 3672

Answers (1)

Related Questions