Docker SQL failing to authenticate the user from Azure Storage Emulator

224 Views Asked by At

I set up docker file using this on my local machine:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=some_pwd" -e "MSSQL_PID=Express" -p 1433:1433 -d --restart=always mcr.microsoft.com/mssql/server:2019-latest

I tried connecting from my local machine via SSMS and it works. However, when I run Azure Storage Emulator (either init, or start command) it fails with

Error: No available SQL Instance was found.

At the same time this occurs in docker logs for the container:

Login failed for user 'sql1\Guest'. Reason: Could not find a login matching the name provided. [CLIENT: XXX.XXX.XXX.XXX]

Docker, SSMS and Azure Storage Emulator are running on the same local machine.

1

There are 1 best solutions below

0
Thiago Custodio On

When initializing the Azure Storage Emulator, you need to specify the database you want to connect. It's looking for a SQL instance in your machine, not inside docker containers.

AzureStorageEmulator.exe init [-server serverName] [-sqlinstance instanceName] [-forcecreate|-skipcreate] [-reserveports|-unreserveports] [-inprocess]

https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#initialize-the-storage-emulator-to-use-a-different-sql-database

https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#storage-emulator-command-line-tool-reference