Get login from Azure SQL database server (PaaS)

Dave Gray 581 Reputation points

Hello I'm trying to get the security/login names from an Azure SQL database. I would have thought the login details would be held at the instance name not the database so I have used Get-AzureRmSqlServer, however I also tried Get-AzureRmSqlDatabase but cannot see how to get this below. There are six logins and I would like to retrieve their names


Code is reduced to a single -ServerName for this question. My PowerShell code:

$Databases = Get-AzureRmSqlDatabase -ResourceGroupName "*********" -ServerName "**********"

foreach ($db in $Databases)
# Write-Host $db.DatabaseName

$sql = Get-AzureRmSqlServer -ResourceGroupName "********" -ServerName "*******"
Write-Host $sql.ServerName

Azure SQL Database
{count} votes

Accepted answer
  1. Vaibhav Chaudhari 38,681 Reputation points

    The login details are stored in Master DB. I think you will have to query sys tables by connecting to Master DB as shown in below

    Get-AzSqlServer PS Command won't list the all the login details AFAIK


    Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful