Arun Pant
Arun Pant

Reputation: 146

Extract hashed user password in Azure SQL DB

I need to get hashed passwords of users in Azure SQL DB (Single Database - Managed Instance). Users exist only on DB and not on server. Users were created with:

Create user xyz with password = 'abc'

I have tried LoginProperty function but it does not work in Azure SQL DB.

Upvotes: 0

Views: 2032

Answers (2)

Jaspreet Singh
Jaspreet Singh

Reputation: 11

this option does not help with Azure SQL Database(PAAS) as i recieved the error: Keyword or statement option 'hashed' is not supported in this version of SQL Server.

Azure SQL does not have this option, it is deprecated. Not sure how a migration will be performed if password is not known of the account.

Upvotes: 1

Leon Yue
Leon Yue

Reputation: 16401

Please see this document: sys.sql_logins (Transact-SQL), it supports Azure SQL database and returns one row for every SQL Server authentication login.

enter image description here

Run this query in your master DB, you can see the user password_hash.

For example, I created a login sagarreadonly' in master db, then created the user 'sagarreadonly' in my SQL database.

I can get the user's hashed password. Here is code:

use master
select name, password_hash from sys.sql_logins where name='sagarreadonly'

Screenshots:

enter image description here

Hope this helps.

Upvotes: 0

Related Questions