Project Icon

Azurite

本地模拟Azure存储服务的开源工具

Azurite是一个开源的Azure存储API兼容服务器,基于Node.js开发,提供跨平台支持。它能在本地环境中模拟Azure存储服务,支持Blob、Queue和Table存储,并与最新的Azure存储API保持同步。Azurite V3采用TypeScript开发,使用代码生成器提高了开发效率和API一致性。这个工具适合开发人员在本地进行Azure存储相关的开发和测试工作。

Azurite V3

npm version Build Status

Note: The latest Azurite V3 code, which supports Blob, Queue, and Table (preview) is in the main branch. The legacy Azurite V2 code is in the legacy-master branch.

VersionAzure Storage API VersionService SupportDescriptionReference Links
3.31.02024-08-04Blob, Queue and Table(preview)Azurite V3 based on TypeScript & New ArchitectureNPM - Docker - Visual Studio Code Extension
Legacy (v2)2016-05-31Blob, Queue and TableLegacy Azurite V2NPM

Introduction

Azurite is an open source Azure Storage API compatible server (emulator). Based on Node.js, Azurite provides cross platform experiences for customers wanting to try Azure Storage easily in a local environment. Azurite simulates most of the commands supported by Azure Storage with minimal dependencies.

Azurite V2 is manually created with pure JavaScript, popular and active as an open source project. However, Azure Storage APIs are growing and keeping updating, manually keeping Azurite up to date is not efficient and prone to bugs. JavaScript also lacks strong type validation which prevents easy collaboration.

Compared to V2, Azurite V3 implements a new architecture leveraging code generated by a TypeScript Server Code Generator we created. The generator uses the same swagger (modified) used by the new Azure Storage SDKs. This reduces manual effort and facilitates better code alignment with storage APIs.

3.0.0-preview is the first release version using Azurite's new architecture.

Features & Key Changes in Azurite V3

  • Blob storage features align with Azure Storage API version 2024-08-04 (Refer to support matrix section below)
    • SharedKey/Account SAS/Service SAS/Public Access Authentications/OAuth
    • Get/Set Blob Service Properties
    • Create/List/Delete Containers
    • Create/Read/List/Update/Delete Block Blobs
    • Create/Read/List/Update/Delete Page Blobs
  • Queue storage features align with Azure Storage API version 2024-08-04 (Refer to support matrix section below)
    • SharedKey/Account SAS/Service SAS/OAuth
    • Get/Set Queue Service Properties
    • Preflight Request
    • Create/List/Delete Queues
    • Put/Get/Peek/Update/Delete/Clear Messages
  • Table storage features align with Azure Storage API version 2024-08-04 (Refer to support matrix section below)
    • SharedKey/Account SAS/Service SAS/OAuth
    • Create/List/Delete Tables
    • Insert/Update/Query/Delete Table Entities
  • Features NEW on V3
    • Built with TypeScript and ECMA native promise and async features
    • New architecture based on TypeScript server generator. Leverage auto generated protocol layer, models, serializer, deserializer and handler interfaces from REST API swagger
    • Flexible structure and architecture, supports customizing handler layer implementation, persistency layer implementation, HTTP pipeline middleware injection
    • Detailed debugging log support, easy bug locating and reporting
    • Works with storage .Net SDK basic and advanced sample
    • SharedKey, AccountSAS, ServiceSAS, OAuth, Public Access authentication support
    • Keep updating with latest Azure Storage API version features (Refer to support matrix)

Getting Started

Try with any of following ways to start an Azurite V3 instance.

GitHub

After cloning source code, execute following commands to install and start Azurite V3.

npm ci
npm run build
npm install -g
azurite

NPM

In order to run Azurite V3 you need Node.js installed on your system. Azurite works cross-platform on Windows, Linux, and OS X. Azurite is compatible with the current Node.Js LTS Versions in support.

After installation you can install Azurite simply with npm which is the Node.js package management tool included with every Node.js installation.

npm install -g azurite

Simply start it with the following command:

azurite -s -l c:\azurite -d c:\azurite\debug.log

or,

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

This tells Azurite to store all data in a particular directory c:\azurite. If the -l option is omitted it will use the current working directory. You can also selectively start different storage services.

For example, to start blob service only:

azurite-blob -l path/to/azurite/workspace

Start queue service only:

azurite-queue -l path/to/azurite/workspace

Start table service only:

azurite-table -l path/to/azurite/workspace

Visual Studio Code Extension

Azurite V3 can be installed from Visual Studio Code extension market.

You can quickly start or close Azurite by clicking Azurite status bar item or following commands.

Extension supports following Visual Studio Code commands:

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

Following extension configurations are supported:

  • azurite.blobHost Blob service listening endpoint, by default 127.0.0.1
  • azurite.blobPort Blob service listening port, by default 10000
  • azurite.queueHost Queue service listening endpoint, by default 127.0.0.1
  • azurite.queuePort Queue service listening port, by default 10001
  • azurite.tableHost Table service listening endpoint, by default 127.0.0.1
  • azurite.tablePort Table service listening port, by default 10002
  • azurite.location Workspace location folder path (can be relative or absolute). By default, in the VS Code extension, the currently opened folder is used. If launched from the command line, the current process working directory is the default. Relative paths are resolved relative to the default folder.
  • azurite.silent Silent mode to disable access log in Visual Studio channel, by default false
  • azurite.debug Output debug log into Azurite channel, by default false
  • azurite.loose Enable loose mode which ignores unsupported headers and parameters, by default false
  • azurite.cert Path to a PEM or PFX cert file. Required by HTTPS mode.
  • azurite.key Path to a PEM key file. Required when azurite.cert points to a PEM file.
  • azurite.pwd PFX cert password. Required when azurite.cert points to a PFX file.
  • azurite.oauth OAuth oauthentication level. Candidate level values: basic.
  • azurite.skipApiVersionCheck Skip the request API version check, by default false.
  • azurite.disableProductStyleUrl Force parsing storage account name from request URI path, instead of from request URI host.
  • azurite.inMemoryPersistence Disable persisting any data to disk. If the Azurite process is terminated, all data is lost.
  • azurite.extentMemoryLimit When using in-memory persistence, limit the total size of extents (blob and queue content) to a specific number of megabytes. This does not limit blob, queue, or table metadata. Defaults to 50% of total memory.

DockerHub

Run Azurite V3 docker image

Note. Find more docker images tags in https://mcr.microsoft.com/v2/azure-storage/azurite/tags/list

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

-p 10000:10000 will expose blob service's default listening port. -p 10001:10001 will expose queue service's default listening port. -p 10002:10002 will expose table service's default listening port.

Or just run blob service:

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

Run Azurite V3 docker image with customized persisted data location

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

-v c:/azurite:/data will use and map host path c:/azurite as Azurite's workspace location.

Customize all Azurite V3 supported parameters for docker image

docker run -p 7777:7777 -p 8888:8888 -p 9999:9999 -v c:/azurite:/workspace mcr.microsoft.com/azure-storage/azurite azurite -l /workspace -d /workspace/debug.log --blobPort 7777 --blobHost 0.0.0.0 --queuePort 8888 --queueHost 0.0.0.0 --tablePort 9999 --tableHost 0.0.0.0 --loose --skipApiVersionCheck --disableProductStyleUrl

Above command will try to start Azurite image with configurations:

-l //workspace defines folder /workspace as Azurite's location path inside docker instance, while /workspace is mapped to c:/azurite in host environment by -v c:/azurite:/workspace

-d //workspace/debug.log enables debug log into /workspace/debug.log inside docker instance. debug.log will also mapped to c:/azurite/debug.log in host machine because of docker volume mapping.

--blobPort 7777 makes Azurite blob service listen to port 7777, while -p 7777:7777 redirects requests from host machine's port 7777 to docker instance.

--blobHost 0.0.0.0 defines blob service listening endpoint to accept requests from host machine.

--queuePort 8888 makes Azurite queue service listen to port 8888, while -p 8888:8888 redirects requests from host machine's port 8888 to docker instance.

--queueHost 0.0.0.0 defines queue service listening endpoint to accept requests from host machine.

--tablePort 9999 makes Azurite table service listen to port 9999, while -p 9999:9999 redirects requests from host machine's port 9999 to docker instance.

--tableHost 0.0.0.0 defines table service listening endpoint to accept requests from host machine.

--loose enables loose mode which ignore unsupported headers and parameters.

--skipApiVersionCheck skip the request API version check.

--disableProductStyleUrl force parsing storage account name from request URI path, instead of from request URI host.

If you use customized azurite parameters for docker image, --blobHost 0.0.0.0, --queueHost 0.0.0.0 are required parameters.

In above sample, you need to use double first forward slash for location and debug path parameters to avoid a known issue for Git on Windows.

Will support more release channels for Azurite V3 in the future.

Docker Compose

To run Azurite in Docker Compose, you can start with the following configuration:

---
version: "3.9"
services:
  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    container_name: "azurite"
    hostname: azurite
    restart: always
    ports:
      - "10000:10000"
      - "10001:10001"
      - "10002:10002"

NuGet

Releasing Azurite V3 to NuGet is under investigation.

Visual Studio

Integrate Azurite with Visual Studio is under investigation.

Supported Command Line Options

Listening Host Configuration

Optional. By default, Azurite V3 will listen to 127.0.0.1 as a local server. You can customize the listening address per your requirements.

Only Accept Requests in Local Machine

--blobHost 127.0.0.1
--queueHost 127.0.0.1
--tableHost 127.0.0.1

Allow Accepting Requests from Remote (potentially unsafe)

--blobHost 0.0.0.0
--queueHost 0.0.0.0
--tableHost 0.0.0.0

Listening

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号