Search code examples
azureazure-sql-database

How can i enable and disable a user in an Azure sql database from SSMS?


I have a user on an azure db . I have connected to the azure db from ssms. I anm trying to disable the user and if required enable them. But there doesnt seem to be a "Properties" option when i right click on the user.

How can i do this ?


Solution

  • How can i enable and disable a user in an Azure sql database from SSMS?

    When you disable/enable Logins of a server it will get affected for all the users that are associated with it as @Dai explained in comments.

    ALTER LOGIN loginname DISABLE/ENABLE
    

    When you want to enable or disable particular user from database you can grant and revoke the connect permission to it, as it can't connect to database it will not be able to perform any action on database such as:

    • To disable users of a database:
    REVOKE CONNECT FROM "username"
    
    • To enable users of a database:
    GRANT CONNECT TO "username"