Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to connect to local Azure storage account

I have initialized a azure storage emulator on my local box but I am unable to connect to it from either visual studio or Azure storage explorer. What am i missing?

Error when i try to connect to a local azure storage account emulator:

Unable to retrieve child resources.
A network error occurred (NetworkTimeoutError: connect ECONNREFUSED 127.0.0.1:10002)

Error in visual studio server explorer if i try to explore storage=>Development:

  Cannot create database 'AzureStorageEmulatorDb59' : The database 'AzureStorageEmulatorDb59' does not exist. Supply a valid database name. To see available databases, use sys.databases..
    Learn more about known storage blob issues and solutions at https://go.microsoft.com/fwlink/?LinkId=532762.

Command to initialize the Azure storage emulator on my machine.

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe init -server . -sqlinstance SQLEXPRESS -forcecreate
Windows Azure Storage Emulator 5.9.0.0 command line tool
Attempting to use server specified.
User specified an instance through /server or /sqlInstance options.
Probing SQL Instance: '.\SQLEXPRESS'.
Found SQL Instance .\SQLEXPRESS.
Creating database AzureStorageEmulatorDb59 on SQL instance '.\SQLEXPRESS'.

Granting database access to user DESKTOP-2LS7578\AjitGoel.
Database access for user DESKTOP-2LS7578\AjitGoel was granted.

Initialization successful. The storage emulator is now ready for use.
The storage emulator was successfully initialized and is ready to use.

Update: I tried to a. add the same name as provided in C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\storageemulatorexplorer.exe.config b. add http://127.0.0.1 to the local interanet zones in internet explorer, c. delete the files in %AppData%\Roaming\StorageExplorer but none of the options above helped.

Azure Storage explorer screenshot Azure Storage explorer screeshot

like image 600
Ajit Goel Avatar asked Dec 11 '22 04:12

Ajit Goel


2 Answers

First, all about the usage of Azure Storage Emulator are in here Use the Azure storage emulator for development and testing, which you need to read carefully.

Second, just per your description, it seems to just re-initialize the emulator, but not start it.

enter image description here

Then, you can check the emulator status via command AzureStorageEmulator status. enter image description here

If there is not True, to run netstat -ano | findstr ":1000." to check whether these ports were occupied by others and find out the PID to kill the related one. enter image description here

Or as the GitHub issue @YASWANTH-MSFT linked said, multiple instances of different version of SQL Server installed on the same machine will cause the emulator not running normally, then you need to remove one of these SQL Server.

Meanwhile, I suggest you also can upgrade your AzureStorageExplorer to try to connect the emulator again. I can connect my old version 5.7.0.0 emulator with the newest version 1.6.2 explorer.

enter image description here

like image 190
Peter Pan Avatar answered Dec 12 '22 21:12

Peter Pan


Here are some of the things that i tried and it finally worked.

a. uninstall sql server express and install only sql server localdb.

b. make sure that the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server\UserInstances parentinstance key has the correct value. I got this from: LocalDB parent instance version invalid: MSSQL13E.LOCALDB

c. Delete the SQL instance:

sqllocaldb stop MSSQLLocalDB
sqllocaldb delete MSSQLLocalDB

Now delete the following database files:

%USERPROFILE%\AzureStorageEmulatorDb*.mdf
%USERPROFILE%\AzureStorageEmulatorDb*.ldf

Finally, recreate the sql instance:

sqllocaldb start MSSQLLocalDB

i got this from: Azure Storage Emulator fails after adding VS 2015 SDK

d. Create the database that the azurestorageemulator init command tries to create manually in visual studio=>sql server object explorer.

e. Run the azurestorageemulator start command to see the azurestorageemulator has been started.

Hopefully this helps someone.

like image 40
Ajit Goel Avatar answered Dec 12 '22 21:12

Ajit Goel