Search code examples
azureazure-storageazure-storage-emulator

Azure storage emulator unable to initialize


I've upgraded Azure Storage Emulator from 2.3 to 2.4. WAStorageEmulator.exe has been renamed to AzureStorageEmulator.exe but that's not the issue.

When I run

AzureStorageEmulator init -forcecreate

I simply get an error that Google returns with zero results:

Error: User-specified instance not found. Please correct this and re-run initial ization.

Edit

I had to do a start and stop and then I was able to init. Because I had previous version of emulator installed I already have WAStorageEmulatorDb34 on my local SQL server instance. After I run init command I can see that no new database is being created (like WAStorageEmulatorDb42).

So I thought that the newest version may be using older DB. I then ran a query in MSSMS to check for existing blob containers and I can still see both containers I created on the older emulator containing blobs I added.

When I then accessed Development Azure Storage in Visual Studio it showed no containers whatsoever. So the new version apparently doesn't use old DB. But which one? And where is it?

Ok so I thought I'd run init one more time but with additional parameters to put DB on my SQL server instance:

AzureStorageEmulator init -server localhost -sqlinstance MSSQLSERVER -forcecreate

And then I get the aforementioned error. Again...

I'm running CMD as admin with elevated permissions.


Solution

  • Solution that eventually worked

    Additional info

    Azure Storage Emulator normally creates tables in the LocalDB storage. Depending on the emulator version these may be in various DB instances. You can check each storage emulator version's configuration in

    %USERPROFILE%\AppData\Local\[AzureStorageEmulatorFolder]\*.config
    

    Different versions have different folder names from DevelopmentStorage, WAStorageEmulator to latest (4.2) AzureStorageEmulator.

    In this subfolder you'll find at least one config file that will correspond to your installed Azure storage emulator's version. If you open it, you'll see how it's configured and where it saved its tables. This is also true if you create initialization on any existing full SQL server instance.

    The problem when I was trying to initialize my Azure Storage Emulator (ASE) is that I was also providing SQL server's instance which is the default one (MSSQLSERVER). I shouldn't be providing this information in the first place but only provide information about server

    So the correct command line call is

    AzureStorageEmulator init -server localhost -forcecreate
    

    This created my database on my local SQL server. From here on, it's up to you how you'll migrate from an existing ASE database (if you already had one before) to the new one.