Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Managed Service for SQL Server™
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Information about existing clusters
    • Creating clusters
    • Connecting to databases
    • Stopping and starting clusters
    • Changing cluster and database settings
    • Managing SQL Server hosts
    • Database management
    • Managing users
    • Assigning privileges and roles
    • Managing backups
    • Deleting clusters
  • Concepts
    • Relationship between service resources
    • Host classes
    • Network in Managed Service for SQL Server
    • Quotas and limits
    • Storage types
    • Backups
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • BackupService
      • ClusterService
      • DatabaseService
      • ResourcePresetService
      • UserService
      • OperationService
    • REST
      • Overview
      • Backup
        • Overview
        • get
        • list
      • Cluster
        • Overview
        • backup
        • create
        • delete
        • get
        • list
        • listBackups
        • listHosts
        • listLogs
        • listOperations
        • move
        • restore
        • start
        • stop
        • update
      • Database
        • Overview
        • create
        • delete
        • get
        • list
      • ResourcePreset
        • Overview
        • get
        • list
      • User
        • Overview
        • create
        • delete
        • get
        • grantPermission
        • list
        • revokePermission
        • update
      • Operation
        • Overview
        • get
  • Questions and answers
    • General questions
  1. Step-by-step instructions
  2. Managing users

Managing users

  • Getting a list of users
  • Adding a user
  • Changing a password
  • Changing user settings
  • Deleting a user
  • Examples
    • Add a user with read-only permissions

You can add and remove users, as well as manage their individual settings.

Getting a list of users

Management console
API
  1. Go to the folder page and select Managed Service for SQL Server.
  2. Click on the name of the cluster you need and then select the Users tab.

Use the list API method: pass the ID of the required cluster in the clusterId request parameter.

To find out the cluster ID, get a list of clusters in the folder.

Adding a user

Management console
API
  1. Go to the folder page and select Managed Service for SQL Server.
  2. Click on the name of the cluster you need and select the tab Users.
  3. Click Add.
  4. Enter a database username and password (from 8 to 128 characters).
  5. Select one or more databases that the user should have access to:
    1. Click Add database.
    2. Select the database from the drop-down list.
    3. Repeat the previous two steps until all the required databases are selected.
    4. To delete a database that was added by mistake, click to the right of the database name.
  6. Set up user roles for each of the selected databases.
  7. Click Create.

Use the create API method and pass the following in the request:

  • ID of the cluster where you want to create a user, in the clusterId parameter. To find out the cluster ID, get a list of clusters in the folder.
  • Username, in the userSpec.name parameter.
  • User password, in the userSpec.password parameter.
  • One or more databases that the user must have access to, in one or more userSpec.permissions.databaseName parameters.
  • User roles for each of the selected databases, in one or more userSpec.permissions.roles parameters.

Changing a password

Management console
API

To change the user's password:

  1. Go to the folder page and select Managed Service for SQL Server.
  2. Click on the name of the cluster you need and select the tab Users.
  3. Click and select Change password.
  4. Set a new password and click Edit.

Use the update API method and pass the following in the request:

  • In the clusterId parameter, the ID of the cluster where the user is located. To find out the cluster ID, get a list of clusters in the folder.
  • Username, in the userName parameter. To find out the username, get a list of users in the cluster.
  • New user password, in the password parameter.
  • List of user configuration fields to be changed (in this case, the password), in the updateMask parameter.

Warning

This API method resets any settings that aren't passed explicitly in the request to their defaults.
To avoid this, be sure to pass the name of the user password field: password, in the updateMask parameter.

Changing user settings

Management console
API

To change the user settings:

  1. Go to the folder page and select Managed Service for SQL Server.
  2. Click on the name of the cluster you need and select the tab Users.
  3. Click and select Configure.
  4. Set up user permissions to access certain databases:
    1. To grant access to the required databases:
      1. Click Add database.
      2. Select the database from the drop-down list.
      3. Repeat the previous two steps until all the required databases are selected.
    2. To revoke access to a specific database, remove it from the list by clicking to the right of the database name.
  5. Set up user roles for each of the selected databases.
  6. Click Save.

Use the update API method and pass the following in the request:

  • In the clusterId parameter, the ID of the cluster where the user is located. To find out the cluster ID, get a list of clusters in the folder.
  • Username, in the userName parameter. To find out the username, get a list of users in the cluster.
  • New values for user settings.
  • List of user configuration fields to be changed, in the updateMask parameter.

Warning

This API method resets any settings that aren't passed explicitly in the request to their defaults.
To avoid this, in the updateMask parameter, list the settings you want to change (in a single line, separated by commas).

Deleting a user

Management console
API
  1. Go to the folder page and select Managed Service for SQL Server.
  2. Click on the name of the cluster you need and select the tab Users.
  3. Click and select Delete.
  4. Confirm user deletion.

Use the delete API method and pass the following in the request:

  • In the clusterId parameter, the ID of the cluster where the user is located. To find out the cluster ID, get a list of clusters in the folder.
  • Username, in the userName parameter. To find out the username, get a list of users in the cluster.

Examples

Add a user with read-only permissions

To add a new user user2 to an existing cluster with read-only access to the db1 database:

  1. Create a user with the name user2. Select the databases that the user should have access to.

  2. Connect to the db1 database under the account of the database owner.

  3. To only grant access rights to the Products table, in the default dbo schema, run the command:

    GRANT SELECT ON dbo.Products TO user2;
    GO
    
  4. To grant access permissions to all the myschema schema tables, run the command:

    GRANT SELECT, INSERT, UPDATE, DELETE ON SCHEMA::myschema TO user2;
    GO
    

To revoke the granted privileges, run the commands:

REVOKE SELECT ON dbo.Products FROM user2;
REVOKE SELECT, INSERT, UPDATE, DELETE ON SCHEMA::myschema FROM user2;
GO
In this article:
  • Getting a list of users
  • Adding a user
  • Changing a password
  • Changing user settings
  • Deleting a user
  • Examples
  • Add a user with read-only permissions
Language / Region
Careers
Privacy policy
Terms of use
Brandbook
© 2021 Yandex.Cloud LLC