I have a bunch of user accounts and server accounts which I need to create on SQL Azure (and then in 4 other environments for (dev,qa,uat & pre-production) and I'm running into some problems.
Problem 1. CREATE LOGIN must be done on master / CREATE USER must be done in the database. but since you can't switch databases with a Use statement, at the very least I'm going to need to do this in 2 batches.
Problem 2. You don't seem to be able to execute the CREATE LOGIN/CREATE USER code in either dynamic sql or as part of an IF block so I can't do an IF NOT EXISTS check around each create statement.
Am I snookered here, or are there any other easy/robust ways to script the creation of SQL Logins & DB Users with some basic existance checking in SQL Azure ?