Giter VIP home page Giter VIP logo

key-vault-node-storage-accounts's Introduction

page_type languages products description urlFragment
sample
javascript
azure
This sample repo includes sample code demonstrating common mechanisms for managing storage account keys using Key Vault.
key-vault-node-storage-accounts

Managed Azure Storage Account Keys for Azure Key Vault using the Azure Node SDK

This sample repo includes sample code demonstrating common mechanisms for managing storage account keys using Key Vault.

Prerequisites

  • node.js 8+
  • An Azure Service Principal for running the sample on your Azure account. You can create an Azure service principal using one of the following guides:

Quickstart

  1. If you don't have it, install node.js

  2. Set the following environment variables using the information from your service principal.

    export AZURE_SUBSCRIPTION_ID={your subscription id}
    export AZURE_CLIENT_ID={your client id}
    export AZURE_CLIENT_SECRET={your client secret}
    export AZURE_TENANT_ID={your tenant id as a GUID}
    export AZURE_CLIENT_OID={Object id of the service principal}
    

    On Windows, use set instead of export.

  3. Clone the repo, install node packages, and run.

    git clone https://github.com/Azure-Samples/key-vault-node-storage-accounts.git key-vault
    cd key-vault
    npm install
    node storage_account_sample.js
    

Note

Certain portions of this sample require authenticated user to execute. For this reason the sample will prompt the user to authenticate with a device code. For more details see in-line comments in storage_acount_sample.js

What does this sample do?

The storage account sample is broken down into 8 different methods called in sequence by the main() method in storage_account_sample.js:

async function main() {
  console.log('Azure Key Vault - Managed Storage Account Key Sample');
  
  // Get or create our sample vault
  const vault = await SampleUtil.getSampleVault();
  
  // Create and add a storage account to our sample vault
  const storageAccount = await addStorageAccount(vault);
  
  // Demonstrate updating properties of the managed storage account
  await updateStorageAccount(storageAccount, vault);
  
  // Demonstrate regeneration of a storage account key
  await regenerateStorageAccountKey(storageAccount, vault);
  
  // Demonstrate listing off the storage accounts in the vault
  await getStorageAccounts(vault);
  
  // Demonstrate the creation of an account-level SAS definition 
  await createAccountSASDefinition(storageAccount, vault);
  
  // Demonstrate the creation of a container-level SAS definition
  await createBlobSASDefinition(storageAccount, vault);
  
  // List all SAS definitions in the account
  await getSASDefinitions(storageAccount, vault);
  
  // Finally, remove the storage account from the vault
  await deleteStorageAccount(vault, storageAccount);
}

References and further reading

key-vault-node-storage-accounts's People

Contributors

daviddesberg avatar microsoftopensource avatar msftgits avatar v-hearya avatar yvprashanth avatar

Watchers

 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.