Use Azurite (Microsoft Azure Storage Emulator) for Development and Testing
toc Table of contents
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.
The project is hosted on GitHub. You can find details here:
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 > firstname.lastname@example.org install D:\Packages\npm\node_modules\azurite\node_modules\keytar > prebuild-install || npm run build + email@example.com added 303 packages from 399 contributors in 63.786s
Make sure you command line can recognize azurite command:
The output looks like the following screenshot:
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.
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.
Connect to Azurite via Microsoft Azure Storage Explorer
You can use Microsoft Azure Storage Explorer to explore the services:
Well-known account and key
- Account name: devstoreaccount1
- Account key: Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
For connections in Azure SDK, you can simply specify the following connection string:
For more details about Azurite, please refer to Use Azurite emulator for local Azure Storage development.