DEV Community

Cover image for Use Azure SQL Server with MSI
Antoine
Antoine

Posted on

2 2

Use Azure SQL Server with MSI

Photo by Kyle Glenn on Unsplash

I have just read this interesting blog about different scenarios supported by SQL Data client.

I am interested in setting an Azure SQL server with:

  • restriction for Managed Service Identity access
  • allowing access for developers on only one server easily (without password)
  • keeping one limited access

This tutorial covers everything i think.

I can:

  • assign a MSI to one Azure SQL Server
  • use Visual Studio Code / Visual Studio supported method to authenticate for developer
  • create a group, to allow a different account to access SQL Server

The Default authentication section worth the read.

And it seems not to limit to SQL as the example shows:

// When deployed to an azure host, the default azure credential will authenticate the specified user assigned managed identity.

string userAssignedClientId = "<your managed identity client Id>";
var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { ManagedIdentityClientId = userAssignedClientId });

var blobClient = new BlobClient(new Uri("https://myaccount.blob.core.windows.net/mycontainer/myblob"), credential);
Enter fullscreen mode Exit fullscreen mode

Hope this helps !

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs