Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear Azure Storage Emulator Data from command line?

My solution is using Azure Emulator. I would like to clear the Azure Storage Emulator Blobs, Queues and Tables without having to perform manual actions. I need to be able to do it from command line, preferably PowerShell.

Server Explorer in Visual Studio 2015, Azure-node:

enter image description here

AzureStorageEmulator.exe help returns the following commands:

  • AzureStorageEmulator.exe init: Initialize the emulator database and configuration.
  • AzureStorageEmulator.exe start: Start the emulator.
  • AzureStorageEmulator.exe stop: Stop the emulator.
  • AzureStorageEmulator.exe status: Get current emulator status.
  • AzureStorageEmulator.exe clear: Delete all data in the emulator.
  • AzureStorageEmulator.exe help [command]: Show general or command-specific help.

However when trying out "clear" the following is returned:

The following services have been succesfully cleared of user data: None

like image 960
Jesper Wilfing Avatar asked Jul 12 '16 12:07

Jesper Wilfing


People also ask

How do I clear my storage emulator?

AzureStorageEmulator.exe start: Start the emulator. AzureStorageEmulator.exe stop: Stop the emulator. AzureStorageEmulator.exe status: Get current emulator status. AzureStorageEmulator.exe clear: Delete all data in the emulator.

Can I uninstall Microsoft Azure storage emulator?

Method 2: Uninstall Microsoft Azure Storage Explorer via Apps and Features/Programs and Features. Look for Microsoft Azure Storage Explorer in the list and click on it. The next step is to click on uninstall, so you can initiate the uninstallation.

How do I run Azure storage emulator as an administrator?

1. Click Start, point to All Programs, and then click Windows Azure SDK. 2. Right-click on Windows Azure SDK Command Prompt and then click Run as administrator.


2 Answers

cd C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator .\AzureStorageEmulator.exe clear all 
like image 192
Jesper Wilfing Avatar answered Sep 17 '22 02:09

Jesper Wilfing


Visual Studio 2022 and Azurite

  • it will not use SQL Server like Legacy Storage Simulator and all the related data is stored as large JSON files in the following folder

    %userprofile%\AppData\Local\Temp\Azurite

Azurite Emulator default location

  • you will see Azurite services starting up in Visual Studio Service Dependencies Window when you open VS with any project that needs this enter image description here
  • Azure Storage Explorer Will automatically connect to this new emulator VIA REST-API and if you using Legacy Emulator and new emulator at the same time you are working with different data sets and New Azure do not use SQL server
  • it seems that Azurite has to explicit stop and clear command at the moment (3.14.3) and if you cannot delete this folder just close both Visual Studio and Storage Explorer and try again.

Visual Studio 2019 and deprecated Azure Storage Emulator

Running "AzureStorageEmulator.exe clear all" & "init" command usually hangs (or may take too much time)

solution: you can go to user folder in following address and delete existing AzureStorageEmulatorDb510.mdf and ldf files.(last suffix 510 stands for version 5.10 of emulator)

C:\Users\[YOUR_USER] 

if you can not delete them you because they are locked, stop Azure Storage Emulator by running AzureStorageEmulator.exe stop and try again or simply by shutting it down from its icon in system tray

like image 23
Iman Avatar answered Sep 18 '22 02:09

Iman