Step 1: Create a key vault
Step 2: Add something to the vault
Step 3: Register an App with Azure
Go to Azure Portal, then go to “Azure Active Directory” Section. In the “App registrations” section, click on “New application registration”
Specify the “Name” and “Sign-on URL”(It does not have to be the real one but required.). For “Application Type” must be “Web app/ API” in order to generate the client secret for the app.
Once its finish, you’ll see the “Application ID”. This will be your Client Id.
Next, click on “Settings” button as shown in the figure below. Go to “Keys” section. Then specify the description and choose the expires and your password in “VALUE” . Finally, click on “Save” button
The secret string will be shown once the saving is complete. This will be the “Client Secret” for the App.
Go to your Azure Key Vault. Then, go to “Access Policies” section. Next, Click on “Add New”.
In the “Configure from template” option choose “Key, Secret, & Certificate Management”. Next, “Select Principal” choose the app that was created in the Active Directory.
Step 4: Client Implementation
1 | var context = new Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext(@"https://login.windows.net/Your Tenant"); |
HTH. 2020-June-27 by Jacky