unable to connect to local Azure storage account
Asked Answered
A

3

5

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

Aeon answered 14/1, 2019 at 5:32 Comment(2)
Did you able to see the local storage account in the storage explorer ?Landlady
@Jayendran, i have added an update to the question. I can see the local storage account but i cannot connect.Aeon
H
10

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

Handoff answered 14/1, 2019 at 10:5 Comment(1)
Thank you @Peter Pan. I did uninstall sql express but i had several other issues trying to get azure emulator to work. no other PID's where running on the azure storage emulator ports.Aeon
A
3

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.

Aeon answered 15/1, 2019 at 4:21 Comment(0)
P
1

The steps mentioned in the link worked for me, so sharing it with wider audience, just in case, above steps don't work for them. They didn't work for me.

Github link

Pliocene answered 7/11, 2020 at 13:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.