2.6 KiB
Azure Storage Emulator
This is a simple guide that will help you set up and run the Azure Storage Emulator on your local machine. The Azure Storage Emulator allows you to develop and test your applications that use Azure Storage services without needing an actual Azure subscription nor Internet connection.
Review the Documentation for more details on how to use the emulator and its features. This document will cover a scenario where you want to run the emulator as close to the real Azure Storage service as possible, which means using triple HTTPS endpoints and OAuth simulation.
Docker Installation
To run the Azure Storage Emulator in a Docker container, follow these steps:
-
Ensure that a container runtime is installed. This repository supports both Docker and Apple
containercommand. -
Build the emulator image using the provided Dockerfile:
./build.sh -
Run the emulator container:
./run.sh
Native Installation
To install the Azure Storage Emulator natively on your machine, follow these steps:
-
Clone the repository:
git clone https://github.com/azure/azurite -
Navigate to the cloned directory:
cd azurite -
Build the emulator package.
npm ci npm run build npm pack -
Install the package globally using npm:
npm install -g azurite-*.tgz -
Remove the clone directory, it will not be needed anymore:
cd .. rm -rf azurite -
Install the Caddy HTTP server.
-
Create an
accounts.envfile in the same directory as therun-server.shscript with the following content:AZURITE_ACCOUNTS=accountname:accountkeyReplace
accountnamewith the desired account name. Use OpenSSL to generate an account key.openssl rand -base64 32You can also generate a deterministic account key using any string as a seed:
echo -n "your-seed-string" | base64 -
Add the following line to your
/etc/hostsfile to map the custom domain names to localhost:127.0.0.1 <accountname>.blob.core.windows.net <accountname>.queue.core.windows.net <accountname>.table.core.windows.net -
Run the server:
./run-server.shYou can add the
--oauthor-oflag to simulate OAuth authentication../run-server.sh --oauth