Reputation: 11933
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:
AzureStorageEmulator.exe help returns the following commands:
However when trying out "clear" the following is returned:
The following services have been succesfully cleared of user data: None
Upvotes: 43
Views: 25926
Reputation: 18876
Visual Studio 2022 and Azurite
%userprofile%\AppData\Local\Temp\Azurite
or maybe
%userprofile%\AppData\Local\.vstools\Azurite
Note. Delete above files and folders and restart Azurite to clean up Azurite. It will remove all data stored in Azurite!!
check always the Output -> Service Dependencies to find the correct location. Recently the location is changed to the following folder
%USERPROFILE%\AppData\Local\.vstools\azurite
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 (%userprofile%) usually in the following address and delete existing AzureStorageEmulatorDb510.mdf and ldf files.(last suffix 510 stands for version 5.10 of emulator)
C:\Users\[YOUR_USER] or %userprofile%
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
Upvotes: 19
Reputation: 940
An alternative approach if you are using Azurite & VS2022+ is to use VSCode Durable Functions Monitor extension to delete the hub in the emulator.
I found Purge and Clean operations (from VSCode ext.) failed against Azurite both when I ran from VS2022 or using docker. They work for me when I am using real Azure storage. This eliminates the annoyance of having to quit VS before you can delete the files.
Deleting the hub in VSCode Durable Functions Monitor is by far the quickest way I have found so far to reset everything before another debug run.
Upvotes: 3
Reputation: 11933
cd C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator
.\AzureStorageEmulator.exe clear all
Upvotes: 82