Skip to content

Latest commit

 

History

History
513 lines (328 loc) · 23.8 KB

File metadata and controls

513 lines (328 loc) · 23.8 KB
title Install and run the Azurite emulator for Azure Storage
description The Azurite open-source emulator provides a free local environment to help accelerate development and testing of your Azure storage applications.
author stevenmatthew
ms.author shaas
ms.date 06/24/2025
ms.service azure-storage
ms.subservice storage-common-concepts
ms.topic how-to
ms.devlang csharp
ms.custom devx-track-csharp, ai-video-demo
ai-usage ai-assisted

Install and run Azurite emulator

Using the Azurite emulator allows developers to fast-track cloud-based application and tool development without the need for internet connectivity.

This article provides instructions for installing and running Azurite, as well as configuring it for local development. For more information about using Azurite, see Use the Azurite emulator for local Azure Storage development.

Azurite supersedes the Azure Storage Emulator, and continues to be updated to support the latest versions of Azure Storage APIs.

Install Azurite

Azurite can be installed and run using various methods, including npm, Docker, and Visual Studio Code. This video shows you how to install and run the Azurite emulator.

[!VIDEO c3badd75-fddb-4f6c-b27d-bab2700c79f1]

The steps in the video are also described in the following sections. Select any of these tabs to view specific instructions relevant to your environment.

Azurite is automatically available with Visual Studio 2022. The Azurite executable is updated as part of new Visual Studio version releases. If you're running an earlier version of Visual Studio, you can install Azurite by using either Node Package Manager (npm), DockerHub, or by cloning the Azurite GitHub repository.

In Visual Studio Code, select the Extensions icon and search for Azurite. Select the Install button to install the Azurite extension.

:::image type="content" source="./media/storage-use-azurite/azurite-vs-code-extension.png" alt-text="A screenshot showing how to search for and install the Azurite extension in Visual Studio Code.":::

You can also navigate to Visual Studio Code extension market in your browser. Select the Install button to open Visual Studio Code and go directly to the Azurite extension page.

Configure Azurite extension settings

To configure Azurite settings within Visual Studio Code, select the Extensions icon. Select the Manage gear button for the Azurite entry. Select Extension Settings.

:::image type="content" source="./media/storage-use-azurite/azurite-configure-extension-settings-sml.png" alt-text="A screenshot showing how to modify the Azurite extension settings." lightbox="media/storage-use-azurite/azurite-configure-extension-settings.png":::

The following settings are supported:

Setting Description Default setting
azurite.blobHost The Blob service listening endpoint. 127.0.0.1
azurite.blobPort The Blob service listening port. 10000
azurite.queueHost The Queue service listening endpoint. 127.0.0.1
azurite.queuePort The Queue service listening port. 10001
azurite.tableHost The Table service listening endpoint. 127.0.0.1
azurite.tablePort The Table service listening port. 10002
azurite.cert Path to a locally trusted PEM or PFX certificate file path to enable HTTPS mode.
azurite.debug Output the debug log to the Azurite channel. false
azurite.key Path to a locally trusted PEM key file, required when Azurite: Cert points to a PEM file.
azurite.location The workspace location path. Visual Studio Code working folder
azurite.loose Enable loose mode, which ignores unsupported headers and parameters. false
azurite.oauth Optional OAuth level. None
azurite.pwd Password for PFX file. Required when Azurite: Cert points to a PFX file.
azurite.silent Silent mode disables the access log. false
azurite.skipApiVersionCheck Skip the request API version check. false
azurite.disableProductStyleUrl Force the parsing of the storage account name from request Uri path, instead of from request Uri host. false
azurite.inMemoryPersistence Disable persisting any data to disk and only store data in-memory. false
azurite.extentMemoryLimit The in-memory extent store (for blob and queue content) limit in megabytes. 50% of the total memory on the host machine
azurite.disableTelemetry Disable telemetry data collection for the current Azurite execution. false

This installation method requires that you have Node.js version 8.0 or later installed. Node Package Manager (npm) is the package management tool included with every Node.js installation. After installing Node.js, execute the following npm command to install Azurite.

npm install -g azurite

Use DockerHub to pull the latest Azurite image by using the following command:

docker pull mcr.microsoft.com/azure-storage/azurite

This installation method requires that you have Git and Node.js version 8.0 or later installed. Clone the GitHub repository for the Azurite project by using the following console command.

git clone https://github.com/Azure/Azurite.git

After cloning the source code, execute following commands from the root of the cloned repo to build and install Azurite.

npm install
npm run build
npm install -g

Run Azurite

Select any of the following tabs to view specific instructions relevant to your environment.

To use Azurite with most project types in Visual Studio, you first need to run the Azurite executable. Once the executable is running, Azurite listens for connection requests from the application. To learn more, see Running Azurite from the command line.

For Azure Functions projects and ASP.NET projects, you can choose to configure the project to start Azurite automatically. This configuration is done during the project setup. While this project configuration starts Azurite automatically, Visual Studio doesn't expose detailed Azurite configuration options. To customize detailed Azurite configuration options, run the Azurite executable before launching Visual Studio.

To learn more about configuring Azure Functions projects and ASP.NET projects to start Azurite automatically, see the following guidance:

Azurite executable file location

The following table shows the location of the Azurite executable for different versions of Visual Studio running on a Windows machine:

Visual Studio version Azurite executable location
Visual Studio Community 2022 C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator
Visual Studio Professional 2022 C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator
Visual Studio Enterprise 2022 C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator

Running Azurite from the command line

You can find the Azurite executable file in the extensions folder of your Visual Studio installation, as detailed in the Azurite executable file location table.

Navigate to the appropriate location and start azurite.exe. After you run the executable file, Azurite listens for connections.

[!div class="mx-imgBorder"] :::image type="content" source="media/storage-use-azurite/azurite-command-line-output-visual-studio-sml.png" alt-text="Screen capture of Azurite command-line output." lightbox="media/storage-use-azurite/azurite-command-line-output-visual-studio.png":::

To learn more about available command line options to configure Azurite, see Command line options.

Running Azurite from an Azure Functions project

In Visual Studio 2022, create an Azure Functions project. While setting the project options, mark the box labeled Use Azurite for runtime storage account.

:::image type="content" source="./media/storage-use-azurite/azurite-azure-functions-sml.png" alt-text="A screenshot showing how to set Azurite to be the runtime storage account for an Azure Functions project." lightbox="media/storage-use-azurite/azurite-azure-functions.png":::

After you create the project, Azurite starts automatically. The location of the Azurite executable file is detailed in the Azurite executable file location table. The output looks similar to the following screenshot:

:::image type="content" source="./media/storage-use-azurite/azurite-azure-functions-output-sml.png" alt-text="A screenshot showing output after setting Azurite to be the runtime storage account for an Azure Functions project." lightbox="media/storage-use-azurite/azurite-azure-functions-output.png":::

This configuration option can be changed later by modifying the project's Connected Services dependencies.

Running Azurite from an ASP.NET project

In Visual Studio 2022, create an ASP.NET Core Web App project. Then, open the Connected Services dialog box, select Add a service dependency, and then select Storage Azurite emulator.

:::image type="content" source="./media/storage-use-azurite/azurite-aspnet-connect-sml.png" alt-text="A screenshot showing how to add Azurite as a dependency to an ASP.NET project." lightbox="media/storage-use-azurite/azurite-aspnet-connect.png":::

In the Configure Storage Azurite emulator dialog box, set the Connection string name field to StorageConnectionString, and then select Finish.

:::image type="content" source="./media/storage-use-azurite/azurite-aspnet-connection-string-sml.png" alt-text="A screenshot showing how to configure a connection string to use Azurite with an ASP.NET project." lightbox="media/storage-use-azurite/azurite-aspnet-connection-string.png":::

When the configuration completes, select Close, and the Azurite emulator starts automatically. The location of the Azurite executable file is detailed in the Azurite executable file location table. The output looks similar to the following screenshot:

:::image type="content" source="./media/storage-use-azurite/azurite-aspnet-output.png" alt-text="A screenshot showing output after connecting an ASP.NET project to the Azurite emulator." lightbox="media/storage-use-azurite/azurite-aspnet-output.png":::

This configuration option can be changed later by modifying the project's Connected Services dependencies.

Note

Azurite can't be run from the command line if you only installed the Visual Studio Code extension. Instead, use the Visual Studio Code command palette to run commands. Configuration settings are detailed at Configure Azurite extension settings.

The Azurite extension supports the following Visual Studio Code commands. To open the command palette, press F1 in Visual Studio Code.

  • Azurite: Clean - Reset all Azurite services persistency data
  • Azurite: Clean Blob Service - Clean blob service
  • Azurite: Clean Queue Service - Clean queue service
  • Azurite: Clean Table Service - Clean table service
  • Azurite: Close - Close all Azurite services
  • Azurite: Close Blob Service - Close blob service
  • Azurite: Close Queue Service - Close queue service
  • Azurite: Close Table Service - Close table service
  • Azurite: Start - Start all Azurite services
  • Azurite: Start Blob Service - Start blob service
  • Azurite: Start Queue Service - Start queue service
  • Azurite: Start Table Service - Start table service

Launch Azurite by issuing the following command:

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

This command tells Azurite to store all data in a particular directory, c:\azurite. If the --location option is omitted, it uses the current working directory.

Run the Azurite Docker image:

The following command runs the Azurite Docker image. The -p 10000:10000 parameter redirects requests from host machine's port 10000 to the Docker instance.

docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 \
    mcr.microsoft.com/azure-storage/azurite

Specify the workspace location:

In the following example, the -v c:/azurite:/data parameter specifies c:/azurite as the Azurite persisted data location. The directory, c:/azurite, must be created before running the Docker command.

docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 \
    -v c:/azurite:/data mcr.microsoft.com/azure-storage/azurite

Run just the blob service

docker run -p 10000:10000 mcr.microsoft.com/azure-storage/azurite \
    azurite-blob --blobHost 0.0.0.0 --blobPort 10000

For more information about configuring Azurite at start-up, see Command-line options.

To get started immediately with the command line, create a directory called c:\azurite, then launch Azurite by issuing the following command:

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

This command tells Azurite to store all data in a particular directory, c:\azurite. If the --location option is omitted, it uses the current working directory.


Command line options

This section details the command line switches available when launching Azurite.

Help

Optional - Get command-line help by using the -h or --help switch.

azurite -h
azurite --help

Listening host

Optional - By default, Azurite listens to 127.0.0.1 as the local server. Use the --blobHost switch to set the address to your requirements.

Accept requests on the local machine only:

azurite --blobHost 127.0.0.1

Allow remote requests:

azurite --blobHost 0.0.0.0

Caution

Allowing remote requests might make your system vulnerable to external attacks.

Optional - By default, Azurite listens to 127.0.0.1 as the local server. Use the --queueHost switch to set the address to your requirements.

Accept requests on the local machine only:

azurite --queueHost 127.0.0.1

Allow remote requests:

azurite --queueHost 0.0.0.0

Caution

Allowing remote requests might make your system vulnerable to external attacks.

Optional - By default, Azurite listens to 127.0.0.1 as the local server. Use the --tableHost switch to set the address to your requirements.

Accept requests on the local machine only:

azurite --tableHost 127.0.0.1

Allow remote requests:

azurite --tableHost 0.0.0.0

Caution

Allowing remote requests might make your system vulnerable to external attacks.


Listening port configuration

Optional - By default, Azurite listens for the Blob service on port 10000. Use the --blobPort switch to specify the listening port that you require.

Note

After using a customized port, you need to update the connection string or corresponding configuration in your Azure Storage tools or SDKs.

Customize the Blob service listening port:

azurite --blobPort 8888

Let the system auto select an available port:

azurite --blobPort 0

The port in use is displayed during Azurite startup.

Optional - By default, Azurite listens for the Queue service on port 10001. Use the --queuePort switch to specify the listening port that you require.

Note

After using a customized port, you need to update the connection string or corresponding configuration in your Azure Storage tools or SDKs.

Customize the Queue service listening port:

azurite --queuePort 8888

Let the system auto select an available port:

azurite --queuePort 0

The port in use is displayed during Azurite startup.

Optional - By default, Azurite listens for the Table service on port 10002. Use the --tablePort switch to specify the listening port that you require.

Note

After using a customized port, you need to update the connection string or corresponding configuration in your Azure Storage tools or SDKs.

Customize the Table service listening port:

azurite --tablePort 11111

Let the system auto select an available port:

azurite --tablePort 0

The port in use is displayed during Azurite startup.


Workspace path

Optional - Azurite stores data to the local disk during execution. Use the -l or --location switch to specify a path as the workspace location. By default, the current process working directory is used. Note the lowercase 'l'.

azurite -l c:\azurite
azurite --location c:\azurite

Access log

Optional - By default, the access log is displayed in the console window. Disable the display of the access log by using the -s or --silent switch.

azurite -s
azurite --silent

Debug log

Optional - The debug log includes detailed information on every request and exception stack trace. Enable the debug log by providing a valid local file path to the -d or --debug switch.

azurite -d path/debug.log
azurite --debug path/debug.log

Loose mode

Optional - By default, Azurite applies strict mode to block unsupported request headers and parameters. Disable strict mode by using the -L or --loose switch. Note the capital 'L'.

azurite -L
azurite --loose

Version

Optional - Display the installed Azurite version number by using the -v or --version switch.

azurite -v
azurite --version

Certificate configuration (HTTPS)

Optional - By default, Azurite uses the HTTP protocol. You can enable HTTPS mode by providing a path to a Privacy Enhanced Mail (.pem) or Personal Information Exchange (.pfx) certificate file to the --cert switch. HTTPS is required to connect to Azurite using OAuth authentication.

When --cert is provided for a PEM file, you must provide a corresponding --key switch.

azurite --cert path/server.pem --key path/key.pem

When --cert is provided for a PFX file, you must provide a corresponding --pwd switch.

azurite --cert path/server.pfx --pwd pfxpassword

HTTPS setup

For detailed information on generating PEM and PFX files, see HTTPS Setup.

OAuth configuration

Optional - Enable OAuth authentication for Azurite by using the --oauth switch.

azurite --oauth basic --cert path/server.pem --key path/key.pem

Note

OAuth requires an HTTPS endpoint. Make sure HTTPS is enabled by providing --cert switch along with the --oauth switch.

Azurite supports basic authentication by specifying the basic parameter to the --oauth switch. Azurite performs basic authentication, like validating the incoming bearer token, checking the issuer, audience, and expiry. Azurite doesn't check the token signature or permissions. To learn more about authorization, see Connect to Azurite with SDKs and tools.

Skip API version check

Optional - When starting up, Azurite checks that the requested API version is valid. The following command skips the API version check:

azurite --skipApiVersionCheck

Disable production-style URL

Optional. When you use the fully qualified domain name instead of the IP in request Uri host, Azurite parses the storage account name from request URI host by default. You can force the parsing of the storage account name from request URI path by using --disableProductStyleUrl:

azurite --disableProductStyleUrl

In-memory persistence

Optional. By default, blob and queue metadata is persisted to disk and content is persisted to extent files. Table storage persists all data to disk. You can disable persisting any data to disk and only store data in-memory. In the in-memory persistence scenario, if the Azurite process is terminated, all data is lost. The default persistence behavior can be overridden using the following option:

azurite --inMemoryPersistence

This setting is rejected when the SQL-based metadata implementation is enabled (via AZURITE_DB), or when the --location option is specified.

Extent memory limit

Optional. By default, the in-memory extent store (for blob and queue content) is limited to 50% of the total memory on the host machine. The total is evaluated using os.totalmem(). This limit can be overridden using the following option:

azurite --extentMemoryLimit <megabytes>

There's no restriction on the value specified for this option. However, virtual memory might be used if the limit exceeds the amount of available physical memory as provided by the operating system. A high limit might eventually lead to out of memory errors or reduced performance. This option is rejected when --inMemoryPersistence isn't specified.

To learn more, see Use in-memory storage.

Disable telemetry collection

Optional. By default, Azurite collects telemetry data to help improve the product. Use the --disableTelemetry option to disable telemetry data collection for the current Azurite execution, like following command:

azurite --disableTelemetry

Next steps