DEV Community 👩‍💻👨‍💻

Cover image for Use Azure SQL Server with MSI
Antoine
Antoine

Posted on

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 !

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.