Lesson Learned #376: Resolving ‘Msg 15151’ error when modifying SQL Login in Azure Active Directory

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

Changing the password of SQL Logins in Azure SQL Database while connected as an Azure Active Directory (AAD) user can lead to encountering an error "Msg 15151, Level 16, State 1, Line 1 - Cannot alter the login 'UserName', because it does not exist or you do not have permission". 

 

When attempting to change the password of a SQL Login in Azure SQL Database while connected as an Azure Active Directory (AAD) user, you may encounter the error message "Msg 15151, Level 16, State 1, Line 1 - Cannot alter the login 'UserName', because it does not exist or you do not have permission." This error occurs when the user connected as an AAD login lacks the necessary permissions to modify SQL Logins or when the targeted SQL Login does not exist.

 

Azure Active Directory admins do not have the permission to change the password of the SQL admin account directly. 

 

To resolve this error, you have a couple of options:

 

1. Switch the connection to a SQL Login user: If you have access to a SQL Login user with the necessary permissions, you can switch your connection to that user and then proceed to change the password of the SQL Login. SQL Login users are managed separately from AAD logins and have the appropriate permissions to modify SQL Logins.

 

2. Use the portal to change the administrator password: Another option is to use the Azure portal or Azure PowerShell to change the password of the SQL administrator account. 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.