Azure, Node.js
·

How to access Azure storage emulator using Node.js SDK

Today I have a quick tip that I want to share with you because it took me some time to figure this out.

I'm using Azure SDK for Node.js to interact with Azure Storage and I want to access my development environment with it.

To access the blob storage, for instance, you just need to create a blob service using the resource name and the access key. Too easy!

    var azure = require('azure-storage');
    var blobService = azure.createBlobService('mystorage', 'my-access-key');

Now I want to access the Azure Storage Emulator running in my machine. How to do it? Just replace the previous code with the following piece of code.

    var azure = require('azure-storage');
    var devStoreCreds = azure.generateDevelopmentStorageCredendentials();
    var blobService = azure.createBlobService(devStoreCreds);

Hope this helps.

Developer Insights

What I'm building, learning, and discovering each week.

Subscribe to newsletter

By signing up, you'll get my free weekly newsletter plus occasional updates about my courses. You can unsubscribe anytime.