I know I can go to each individual database and run:
SELECT name AS username FROM sys.sysusers
And that gets me a list of users for that Azure SQL Database.
And from the master DB on the Azure SQL Server, I can run:
SELECT name AS databasename FROM dbo.sysdatabases
But what I can't figure out for Azure is how to loop through all the databases and, for each database, list its users.
I obviously can't create a loop for USE @databasename since USE doesn't work for Azure SQL Databases.
The best I can do is write code to create code. I looped through the databases and printed out a string to run sqlcmd for each database. Obviously not ideal, but it was the best I could come up with.
Does anyone have any better suggestions for looping through all the Azure SQL Databases on an Azure SQL Server and running commands on each database?