You can create standard, privileged, and global read-only accounts for an ApsaraDB RDS for SQL Server instance in the ApsaraDB RDS console or by calling an API operation.
Prerequisites
-
The first account that you create for an instance must be a privileged account or a superuser account (SA permissions).
-
You can create privileged accounts and standard accounts for instances of all instance families. You can create global read-only accounts for instances that meet the following requirements:
-
Database engine version: SQL Server 2016 or later.
-
Instance family: general-purpose or dedicated.
-
-
Account limits:
-
Standard accounts: No limit.
-
Privileged accounts: A maximum of one privileged account per instance.
-
Global read-only accounts: A maximum of two global read-only accounts per instance.
-
Account permission rules
Privileged account
|
Scenario |
Permission behavior |
|
Create a privileged account |
When you create a privileged account, the system automatically grants it the db_owner role for all existing databases. Manual authorization is not required. |
|
Add a database |
|
|
Delete a privileged account |
|
|
Recreate a privileged account |
|
Standard account
|
Scenario |
Permission behavior |
|
Create a standard account |
|
|
Add a database |
|
|
Delete a standard account |
|
|
Recreate a standard account with the same name |
|
Global read-only account
|
Scenario |
Permission behavior |
|
Create a global read-only account |
|
|
Add a database |
The account automatically gains read-only access to new databases. |
|
Delete a global read-only account |
|
|
Recreate a global read-only account |
|
Important notes
-
Use strong passwords: To ensure database security, set a strong password for your database account and change it regularly. You can also set a password policy for an account to control the password validity period and enhance account security.
-
Follow the principle of least privilege: Assign permissions according to the principle of least privilege. Create accounts based on business roles and assign read-only and read/write permissions as needed. If necessary, create database accounts and databases with finer granularity. This ensures that each database account can access only the data that is required for its business. If write operations are not required, assign read-only permissions.
Create an account
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
-
In the left-side navigation pane, click Accounts.
-
Click Create Account and configure the following parameters.
NoteThe first account for an instance must be a privileged account or a superuser account. You can create other account types only after one of these exists.
Privileged account
Parameter
Description
Database Account
Enter a name for the database account. The name must start with a lowercase letter and end with a lowercase letter or a digit. The name can contain lowercase letters, digits, and underscores (_). The account name cannot be the same as a keyword.
Account Type
Select Privileged Account. Each instance supports only one privileged account.
New Password
Enter a password for the account. The password must meet the following requirements:
-
The password must be 8 to 32 characters in length.
-
The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
-
The following special characters are supported:
!@#$%^&*()_+-=.
Confirm Password
Enter the password again to confirm.
Apply password policy
By applying a password policy, you can control the password validity period and enhance account security. Before you apply a policy, you must set a password policy for the account.
Description
Enter a description. The description can be up to 256 characters in length.
Standard account
Parameter
Description
Database Account
Enter a name for the database account. The name must start with a lowercase letter and end with a lowercase letter or a digit. The name can contain lowercase letters, digits, and underscores (_). The account name cannot be the same as a keyword.
Account Type
Select Standard Account. An instance can have multiple standard accounts.
Authorize Database:
You can grant a Standard Account permissions on one or more databases and set different permissions for each database. If no databases exist, you can leave this field empty and grant permissions to the account later. To grant permissions, perform the following steps:
-
In the Unauthorized Databases list, select the databases that you want to authorize.
-
Click
to add the databases to the Authorized Databases list. -
Set permissions on the databases for the account. You can set the permissions to Read/Write (DML), Read-Only, or Owner. For more information about permissions, see Account permissions.
New Password
Enter a password for the account. The password must meet the following requirements:
-
The password must be 8 to 32 characters in length.
-
The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
-
The following special characters are supported:
!@#$%^&*()_+-=.
Confirm Password
Enter the password again to confirm.
Apply password policy
By applying a password policy, you can control the password validity period and enhance account security. Before you apply a policy, you must set a password policy for the account.
Description
Enter a description. The description can be up to 256 characters in length.
Global read-only account
Parameter
Description
Database Account
Enter a name for the database account. The name must start with a lowercase letter and end with a lowercase letter or a digit. The name can contain lowercase letters, digits, and underscores (_). The account name cannot be the same as a keyword.
Account Type
Select global read-only account. After this account is created, it is automatically granted read-only permissions on all existing databases in the instance. These permissions also apply to new databases.
New Password
Enter a password for the account. The password must meet the following requirements:
-
The password must be 8 to 32 characters in length.
-
The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
-
The following special characters are supported:
!@#$%^&*()_+-=.
Confirm Password
Enter the password again to confirm.
Apply password policy
By applying a password policy, you can control the password validity period and enhance account security. Before you apply a policy, you must set a password policy for the account.
Description
Enter a description. The description can be up to 256 characters in length.
-
-
Click OK. After the page refreshes, you can view the account that you created.
References
-
Create a database account with SA permissions in the console.
-
Create different types of database accounts by calling the CreateAccount API operation.
-
Delete different types of database accounts by calling the DeleteAccount API operation.