Securing our applications and data is critical in this day and age. I’ve been working a lot with the new Microsoft identity platform (MSAL) library, so I decided to create a series of blog posts around working with it.
Using Environment Variable
Your setup may vary depending on the IDE you are using, Visual Studio, Jetbrains Rider, IntelliJ, Visual Studio Code, etc. I’m going to show you how to set up your Environment variables to use the
DefaultAzureCredentials. For this, you will need the Application (Client) ID, Directory (Tenant) ID, and Client Secret (password) obtained from registering your application with the Azure portal. If you need to register an application, check out the post Register an application.
- Open up your environment variables.
- Enter the following environment variables.
||The Azure application/client id||
||The client secret/password||
||The directory/tenant id||
NOTE These are not real values!
NOTE Depending on your IDE, Terminal, etc, you may need to restart it after updating these values.
The procedure may vary depending on your environment/shell. For ZSH/bash, add the following your profile.
1 2 3 export AZURE_CLIENT_ID=6c04f5c5-97f7-486d-bbb2-eeeeeeeeee export AZURE_CLIENT_SECRET=QPxyBvw3.UE8Bw6AJAt63pWx~BB40deded export AZURE_TENANT_ID=bee716cf-fa94-4610-b72e-5df4bf5a9999