How do I create a new user in a SQL Azure database?

后端 未结 9 1693
礼貌的吻别
礼貌的吻别 2020-12-12 13:17

I am trying to use the following template:

-- =================================================
-- Create User as DBO template for SQL Azure Database
-- ====         


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 13:45

    I found this link very helpful:
    https://azure.microsoft.com/en-gb/documentation/articles/sql-database-manage-logins/

    It details things like:
    - Azure SQL Database subscriber account
    - Using Azure Active Directory users to access the database
    - Server-level principal accounts (unrestricted access)
    - Adding users to the dbmanager database role

    I used this and Stuart's answer to do the following:
    On the master database (see link as to who has permissions on this):

    CREATE LOGIN [MyAdmin] with password='ReallySecurePassword'
    

    And then on the database in question:

    CREATE USER [MyAdmin] FROM LOGIN [MyAdmin]
    ALTER ROLE db_owner ADD MEMBER [MyAdmin]
    

    You can also create users like this, according to the link:

    CREATE USER [mike@contoso.com] FROM EXTERNAL PROVIDER;
    

提交回复
热议问题