Giter Site home page Giter Site logo

secureappsettingsdotnetcoresample's Introduction

SecureAppSettingsDotNetCoreSample

A sample app demonstrates storing and retrieving sensitive app settings from an Azure Key Vault. To try out the app, you need a valid Azure subscription which has permission to create an Azure Key Vault. Below is the recap of the steps. For more details and insights, check out the blog post.

Set up:

  1. Register the app in Azure Active Directory.

  2. Generate the key (app secret). Take note of the app id and secret.

  3. Create an Azure Key Vault. Note the DNS Name of the vault under Overview.

  4. Add the secret. Set Name = "My Secret Key", Value = "Insert your secret value here".

  5. Grant the app Get and List permissions to the vault using Access Control.

  6. Add the app id and secret to the environment variables. You may need to restart your machine for the changes to take effect. For MacOS, setting the environment variables is a bit tricky. I learned from this post which references this SO thread

    OS-X GUI apps will not inherit your private/custom env vars that are defined via a shell (bash, zsh, etc...) if they are launched from Finder/Spotlight.

    Essentially, all you need is adding these lines in your .bash_profile. The last line is for Visual Studio to read the environments when we launch it from Finder/Spotlight

export SECURE_APP_Vault__ClientId="Insert the Application Id in step 2."
export SECURE_APP_Vault__ClientSecret="Insert the key generated in step 2."
alias vs='/Applications/Visual\ Studio.app/Contents/MacOS/VisualStudio &'

For Windows, you can just add the SECURE_APP_Vault__ClientId and SECURE_APP_Vault__ClientSecret under the user environment variables.

Run the app. If everything is set up correctly, the app should returns a json object showing the secret value you set in the vault.

secureappsettingsdotnetcoresample's People

Contributors

taithienbo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.