top of page

Go Password-less in Azure Development 🚀🔐


While working with Azure services, especially with Managed Identities, we often rely on DefaultAzureCredential() for seamless authentication.


Managed Identities, however, work only with services deployed on Azure, so when we're developing locally (like in Visual Studio), we typically fall back on Service Principals with a ClientId and ClientSecret.


Sensitive information like the ClientSecret often ends up in config files (appsettings, web.config) to make local development work.

However, you can completely go password-less on your local development boxes too!

Follow these simple steps to make it happen:

  1. Close Visual Studio

  2. Open PowerShell and run az login (install the az modules if needed).

  3. A browser window will pop up, prompting you to sign in with your Azure account credentials. Once signed in, close the PowerShell window.

  4. Reopen Visual Studio and ensure you’re logged in with the same account used for Azure subscription (check the top right corner to confirm).

  5. Go to Tools → Options → Azure Service Authentication → Account Selection. Add your Microsoft account and sign in with your Azure account.


That’s it! You’re now all set for local development and debugging without storing any sensitive credentials.

Here’s a sample code snippet for reference using Azure Key Vault (AKV):

  1. Just the AKV URL and secret name are required, same as when deploying to Azure.

  2. Make sure you're on the Access Review list with the right permissions for the AKV resource.


Hope this was useful.

2 views0 comments

Kommentare


bottom of page