%3CLINGO-SUB%20id%3D%22lingo-sub-368926%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%2329%3A%20Getting%20the%20error%20message%20%3A%20The%20login%20already%20has%20an%20account%20under%20a%20different%20user%20name%20while%20importing%20a%20bacpac%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-368926%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Aug%2010%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Today%2C%20I%20worked%26nbsp%3Bin%20a%20service%20request%20where%20our%20customer%20got%26nbsp%3B%20the%20error%20message%3A%20Msg%2015063%2C%20Level%2016%2C%20State%201%2C%20Line%201%20The%20login%20already%20has%20an%20account%20under%20a%20different%20user%20name%2C%20each%20time%20that%20they%20are%20importing%20a%20bacpac%20file.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Analyzing%20the%20situation%2C%20I%20saw%20that%20the%20bacpac%20file%20was%20generated%20in%20another%20Azure%20SQL%20Database%20Server%26nbsp%3Band%20our%20customer%20is%20trying%20to%20import%20into%26nbsp%3Banother%20Azure%20SQL%20Database%20Server.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Normally%2C%20this%20error%20message%20means%20that%20you%20have%20a%20database%20user%20already%20mapped%20to%20a%20login.%20But%20in%20this%20case%20there%20is%20a%20new%20database%20so%2C%20this%20situation%20should%20not%20be%26nbsp%3Boccurred.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20I%20was%20able%20to%20reproduce%20the%20issue%20with%20the%20following%20combination%20of%20factors%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EThe%20Bacpac%20came%20from%20a%20Azure%20SQL%20Database%20where%20the%20administrator%20user%20has%20the%20name%20MyUser%20and%20the%20user%20of%20the%20database%20has%20the%20name%20MyUserA%20associated%20to%20a%20login.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EThe%20target%20server%20has%26nbsp%3Badministrator%20login%20with%20name%20MyUserA.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20At%20the%20moment%20of%20the%20import%20process%20our%20customer%20got%20the%20error%20Msg%2015063%2C%20Level%2016%2C%20State%201%2C%20Line%201%20The%20login%20already%20has%20an%20account%20under%20a%20different%20user%20name%20because%20at%20the%20moment%20of%20the%20execution%20of%20CREATE%20USER%20%5BMyUserA%5D%20FOR%20LOGIN%20%5BMyUserA%5D%20by%20the%20import%20process%2C%20even%20when%20a%20new%20database%20is%20generating%2C%20due%20to%26nbsp%3Bis%20not%20possible%20to%20create%20a%20user%20that%20is%20associated%20with%20the%26nbsp%3Badministrator%20login.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20In%20this%20situation%2C%20a%20contained%20user%20will%20be%20better%20than%20using%20a%20user%20with%20login%20mapping.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Enjoy!%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-368926%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Aug%2010%2C%202017%20Today%2C%20I%20worked%26nbsp%3Bin%20a%20service%20request%20where%20our%20customer%20got%26nbsp%3B%20the%20error%20message%3A%20Msg%2015063%2C%20Level%2016%2C%20State%201%2C%20Line%201%20The%20login%20already%20has%20an%20account%20under%20a%20different%20user%20name%2C%20each%20time%20that%20they%20are%20importing%20a%20bacpac%20file.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-368926%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Ebacpac%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Econtained%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ecreate%20user%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Efor%20login%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ethe%20login%20already%20has%20an%20account%20under%20a%20different%20user%20name%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
First published on MSDN on Aug 10, 2017
Today, I worked in a service request where our customer got  the error message: Msg 15063, Level 16, State 1, Line 1 The login already has an account under a different user name, each time that they are importing a bacpac file.

Analyzing the situation, I saw that the bacpac file was generated in another Azure SQL Database Server and our customer is trying to import into another Azure SQL Database Server.

Normally, this error message means that you have a database user already mapped to a login. But in this case there is a new database so, this situation should not be occurred.

I was able to reproduce the issue with the following combination of factors:

  • The Bacpac came from a Azure SQL Database where the administrator user has the name MyUser and the user of the database has the name MyUserA associated to a login.

  • The target server has administrator login with name MyUserA.


At the moment of the import process our customer got the error Msg 15063, Level 16, State 1, Line 1 The login already has an account under a different user name because at the moment of the execution of CREATE USER [MyUserA] FOR LOGIN [MyUserA] by the import process, even when a new database is generating, due to is not possible to create a user that is associated with the administrator login.

In this situation, a contained user will be better than using a user with login mapping.

Enjoy!