Use Azurite (Microsoft Azure Storage Emulator) for Development and Testing

Raymond Raymond event 2021-09-05 visibility 5,197
more_vert
Use Azurite (Microsoft Azure Storage Emulator) for Development and Testing

In early stages, Microsoft Azure Storage Emulator is a software that runs on Windows machine to emulate Azure storage services for local development and testing. It is now replaced by Azurite, the open source successor that is based on Node.js. Since it is Node.js based, you can now run it on different platforms. With Azurite, it can save some cost in development and testing environments before deploying to Azure.

Project website

The project is hosted on GitHub. You can find details here:

Azure/Azurite: A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies.

Install Azurite

Before you can install Azurite, please ensure you have npm CLI tool available in your machine. 

Run the following command to install Azurite:

npm install -g azurite

The following are the output when running it in my own computer. D:\Packages\npm is the default location for global npm packages I've configured previously. 

npm install -g azurite
D:\Packages\npm\azurite -> D:\Packages\npm\node_modules\azurite\dist\src\azurite.js
D:\Packages\npm\azurite-blob -> D:\Packages\npm\node_modules\azurite\dist\src\blob\main.js
D:\Packages\npm\azurite-queue -> D:\Packages\npm\node_modules\azurite\dist\src\queue\main.js
D:\Packages\npm\azurite-table -> D:\Packages\npm\node_modules\azurite\dist\src\table\main.js

> keytar@7.7.0 install D:\Packages\npm\node_modules\azurite\node_modules\keytar
> prebuild-install || npm run build

+ azurite@3.14.0
added 303 packages from 399 contributors in 63.786s

Make sure you command line can recognize azurite command:

azurite -h

The output looks like the following screenshot:

2021090573736-image.png

You may encounter the following error:

'azurite' is not recognized as an internal or external command,
operable program or batch file.

To get it work, add npm prefix into your environment variable PATH (for Windows machine).

Refer to article ng is not recognized as an internal or external command (Windows 10) to learn how to do that.

Start Azurite 

Now let's start the service using the following command:

azurite --silent --location F:\azurite --debug F:\azurite\debug.log

The above command specifies F:\azurite as the location for storing all files and logs. 

Once the services are started properly, it will print out the endpoints for Blob, Queue and Table services. 

2021090574056-image.png

Connect to Azurite via Microsoft Azure Storage Explorer 

You can use Microsoft Azure Storage Explorer to explore the services:



2021090574523-image.png

Well-known account and key

  • Account namedevstoreaccount1
  • Account key: Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==

For connections in Azure SDK, you can simply specify the following connection string:

UseDevelopmentStorage=true

For more details about Azurite, please refer to Use Azurite emulator for local Azure Storage development.

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts