0

In the Azure Portal, when navigating to a SQL Server, I can see/edit it's users and AD Admin.

Is there a way to get/list all users & admin(s) of SQL Server via API?
Looking thru the Azure API Reference I couldn't find any such API.

Edit: By SQL Users I mean users set via: enter image description here By AD Admin I mean the user set via: enter image description here

Nadav
  • 1,167
  • 2
  • 19
  • 43

1 Answers1

1

Users: via powershell or via REST - see "List role assignments at a specific scope"

AD Administrator: via powershell- see "Provision an Azure AD administrator for Azure SQL Server by using PowerShell". There seems to be a reference that would indicate an intent to expose this via the REST API, but it seems to be missing from the documentation. Let me see what we can do about that.


Edit: The powershell command that would list all Role assignments for a specific SQL server would be:

Get-AzureRmRoleAssignment -ResourceGroupName <your resource group name> -ResourceType Microsoft.Sql/servers -ResourceName <your server name> -IncludeClassicAdministrators

A similar approach is possible with the REST commands.

Important to note: This only enumerates the Azure permission set, and no RBAC on the SQL Server level is enumerated here.

Dan Rediske
  • 852
  • 4
  • 14
  • exactly what I was looking for! can you elaborate on the use of atScope()> ?what is its parameter? – Nadav Aug 29 '16 at 21:41
  • On which approach are you asking for more guidance? – Dan Rediske Aug 29 '16 at 23:09
  • I'd like to receive the users who's role includes access to specific resource. e.g. SQL Server, as in my original question – Nadav Aug 30 '16 at 09:36
  • If you're asking for help with the REST commands specifically, please specify. – Dan Rediske Aug 30 '16 at 16:05
  • Thanks, I've managed to use this API for all that I needed, except for getting the admin - any idea when/if this will be exposed via the API? – Nadav Sep 12 '16 at 09:06