4
votes

I am in the process of setting up a developer image Azure.

I installed the latest Azure Storage Emulator (v5.3) and then installed SQL Server 2017.

Azure Storage Emulator fails to create the database. Here are the logs :

c:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>sqllocaldb i
MSSQLLocalDB

c:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe init
Windows Azure Storage Emulator 5.3.0.0 command line tool
Found SQL Instance (localdb)\MSSQLLocalDB.
Creating database AzureStorageEmulatorDb53 on SQL instance '(localdb)\MSSQLLocalDB'.
Cannot create database 'AzureStorageEmulatorDb53' : The database 'AzureStorageEmulatorDb53' does not exist. Supply a valid database name. To see available databases, use sys.databases..
One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again.
Error: Cannot create database 'AzureStorageEmulatorDb53' : The database 'AzureStorageEmulatorDb53' does not exist. Supply a valid database name. To see available databases, use sys.databases..

c:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>sqllocaldb v
Microsoft SQL Server 2017 (14.0.1000.169)

Does the emulator v5.3 not work with server 2017 ?

2

2 Answers

1
votes

This worked (note powershell) :

Invoke-WebRequest https://download.microsoft.com/download/9/0/7/907AD35F-9F9C-43A5-9789-52470555DB90/ENU/SqlLocalDB.msi -OutFile SqlLocalDB.msi

msiexec /i SqlLocalDB.msi /qn /norestart IACCEPTSQLLOCALDBLICENSETERMS=YES

Invoke-WebRequest http://download.microsoft.com/download/1/F/C/1FCF23A3-BBD8-4F50-B5C2-E382F14A2AAD/MicrosoftAzureStorageEmulator.msi -OutFile MicrosoftAzureStorageEmulator.msi

msiexec /i MicrosoftAzureStorageEmulator.msi /qn

Remove-Item -Force *.msi

setx /M AZ_STOR_EMU_HOME "%ProgramFiles(x86)%\Microsoft SDKs\Azure\Storage Emulator"

setx /M PATH "%PATH%;%AZ_STOR_EMU_HOME%"

cd "C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator"

Start-Process -FilePath "AzureStorageEmulator.exe" -ArgumentList "init"

The above script will use Microsoft SQL Server 2016 LocalDB and Microsoft Azure Storage Emulator v5.3. Now the emulator initializes correctly.

I picked this up from the dockerfile found here.

1
votes

Force the creation of a database on localhost:

Start -> Microsoft Azure Storage Command Line

cd "Storage Emulator"
AzureStorageEmulator init -sqlinstance . -forcecreate
AzureStorageEmulator start