Roles and permissions on azure sql db

rajanisqldev-42 221 Reputation points
2021-02-03T20:57:12.463+00:00

Hi
I am new to azure sql.

I have created azure sql database in elastic pool. Integrated with Azure AD.
Also created roles

  1. Admins( needread/write permissions)
  2. Dbreaders(need only select permissions)
  3. Moderators(need only create and select permissions)
  4. Financeusers(need only select permission only on Finance schema)

How can I grant the corresponding permissions to the above roles)

I mean Tsql statements

Thanks in advance

Azure SQL Database
0 comments No comments
{count} votes

Accepted answer
  1. KalyanChanumolu-MSFT 8,351 Reputation points
    2021-02-04T03:39:08.857+00:00

    @rajanisqldev-42 Thank you for reaching out.

    Admins
    There is a built in db_datawriter role that provides INSERT, UPDATE, and DELETE permissions.

    ALTER ROLE db_datawriter ADD MEMBER Admins  
    

    Dbreaders
    There is a built in db_datareader role. You can add your role as member

    ALTER ROLE db_datareader ADD MEMBER Dbreaders  
    

    Moderators

    ALTER ROLE db_datareader ADD MEMBER Moderators;  
    GRANT CREATE Table TO Moderators;   
    

    FinanceUsers

     GRANT SELECT ON SCHEMA :: [Finance] TO Financeusers;    
    

    Please let us know if you have further questions

    ----------

    If an answer is helpful, please "Accept answer" or "Up-Vote" for the same which might be beneficial to other community members reading this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.