Question: What may be a cause of the error shown below. The user running the code below is a member of db_securityadmin
database role:
ALTER SERVER ROLE db_ddladmin ADD MEMBER [myDomainName.com\Juan]
Msg 15151, Level 16, State 1, Line 3 Cannot add the principal 'myDomainName.com\Juan', because it does not exist or you do not have permission.
Remark: User [email protected]
does exist and can login to his laptop as [email protected]
. The following code also gives the same error:
ALTER SERVER ROLE db_ddladmin ADD MEMBER [[email protected]]
[email protected]
exists in theSecurity\logins
folder of SQL Managed Instance. But, we missed the following step in current db first:CREATE USER [[email protected]] FROM LOGIN [[email protected]]
. Afterwards, the issue was resolved. For benefits of other users, if you like, you can explain the process in a bit more details - and I'll mark it as anAnswer
.