Cloud SQL - SQL Server roles can function as either individual roles or groups of roles. A user, essentially, is a role that possesses the ability to log in, granted by the LOGIN permission. Since all roles created by Cloud SQL hold the LOGIN permission, the terms “role” and “user” are used interchangeably in this context.
Superusers and System Stored Procedures
Given that Cloud SQL for SQL Server operates as a managed service, it restricts access to certain system stored procedures and tables that require elevated privileges. Superuser permissions, which would allow for unrestricted access, cannot be created or utilized within Cloud SQL. Consequently, the sysadmin role is not supported, preventing the execution of system stored procedures that demand sysadmin privileges.
Default SQL Server Users
Upon setting up a new Cloud SQL for SQL Server instance, the default sqlserver user is automatically created. This user is assigned to the CustomerDbRootRole, which grants a comprehensive set of permissions, including ALTER ANY CONNECTION, ALTER ANY LOGIN, CREATE ANY DATABASE, and more. However, the sysadmin and dbcreator roles are not supported in Cloud SQL for SQL Server.
Granting Server Permissions
When employing any GRANT command to grant privileges, it is mandatory to specify CustomerDbRootRole as the value of grantor_principal.
Creating Additional SQL Server Users
The creation of additional SQL Server users or roles is permitted within Cloud SQL. All users created through Cloud SQL are bestowed with the same database permissions as the sqlserver login. However, if a user is created using a different method (not through Cloud SQL), the user will not possess the same permissions as the sqlserver user or customer administrator accounts.
Database Imports and User Permissions
During the process of importing a database, Cloud SQL manages ownership based on the owner type. For existing logins that differ from sa, Cloud SQL maintains that ownership and establishes a sqlserver user with specific permissions.
Modifying User Permissions
To alter user permissions, the ALTER ROLE command can be utilized. If a new user is created using a client, it can be linked to a different role or granted distinct permissions.
While Cloud SQL allows for the creation of additional SQL Server users, these users, when created through Cloud SQL, inherit the same database permissions as the sqlserver login. However, if created using a different process, these users will not possess the same permissions as the sqlserver user or customer administrator accounts. Additionally, the sysadmin role is not supported in Cloud SQL for SQL Server.