Skip to content

Commit e59ba7a

Browse files
committed
Security rewrite
1 parent 9b0b7d6 commit e59ba7a

11 files changed

Lines changed: 87 additions & 224 deletions

‎docs/advanced-analytics/concepts/extensibility-framework.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ The architecture is designed such that external scripts run in a separate proces
4444

4545
Components include a **Launchpad** service used to invoke language-specific launchers (R or Python), language and library-specific logic for loading interpreters and libraries. The Launcher loads a language run time, plus any proprietary modules. For example, if your code includes RevoScaleR functions, a RevoScaleR interpreter would load. **BxlServer** and **SQL Satellite** manage communication and data transfer with SQL Server.
4646

47+
<a name="launchpad"></a>
48+
4749
## Launchpad
4850

4951
The SQL Server Trusted Launchpad is a service that manages and executes external scripts, similar to the way that the full-text indexing and query service launches a separate host for processing full-text queries. The Launchpad service can start only trusted launchers that are published by Microsoft, or that have been certified by Microsoft as meeting requirements for performance and resource management.

‎docs/advanced-analytics/concepts/security.md‎

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,15 @@ This article describes the overall security architecture that is used to connect
2222

2323
## User security
2424

25-
A SQL Server login or Windows user account is required to run external scripts that use SQL Server data or that run with SQL Server as the compute context.
25+
A SQL Server login or Windows user account is required to run external scripts that use SQL Server data or that run with SQL Server as the compute context.
2626

27-
The login or user account identifies the *security principal*, who might need multiple levels of access, depending on the external script requirements:
27+
+ For SQL logins: Ensure that the login has appropriate permissions on the database where you are reading data. You can do this by adding *Connect to* and *SELECT* permissions, or by adding the login to the `db_datareader` role. To create objects, assign `DDL_admin` rights. If you must save data to tables, add to the `db_datawriter` role.
2828

29-
+ Permission to access the database where external scripts are enabled.
30-
+ Permissions to read data from secured objects such as tables.
31-
+ The ability to write new data to a table, such as a model, or scoring results.
32-
+ The ability to create new objects, such as tables, stored procedures that use the external script, or custom functions that use R or Python job.
33-
+ The right to install new packages on the SQL Server computer, or use packages provided to a group of users.
29+
+ For Windows authentication: You might need to create an ODBC data source on the data science client that specifies the instance name and other connection information. For more information, see [ODBC data source administrator](../../odbc/admin/odbc-data-source-administrator.md).
3430

35-
Therefore, each person who runs an external script using SQL Server as the execution context must be mapped to a user in the database. Under SQL Server security, it is easiest to create roles to manage sets of permissions, and assign users to those roles, rather than individually set user permissions.
31+
For more information, see [Give users permission to SQL Server Machine Learning Services](../../advanced-analytics/administration/user-permission.md).
3632

37-
Even users who are using R or Python in an external tool must be mapped to a login or account in the database if the user needs to run an external script in-database, or access database objects and data. The same permissions are required whether the external script is sent from a remote data science client or started using a T-SQL stored procedure.
38-
39-
For example, assume that you created an external script that runs on your local computer, and you want to run that code on SQL Server. You must ensure that the following conditions are met:
40-
41-
+ The database allows remote connections.
42-
+ The SQL login or Windows account that you used for database access has been added to the SQL Server at the instance level.
43-
+ The SQL login or Windows user must have the permission to execute external scripts. Generally, this permission can only be added by a database administrator.
44-
+ The SQL login or Window user must be added as a user, with appropriate permissions, in each database where the external script performs any of these operations:
45-
+ Retrieving data.
46-
+ Writing or updating data.
47-
+ Creating new objects, such as tables or stored procedures.
48-
49-
After the login or Windows user account has been provisioned and given the necessary permissions, you can run an external script on SQL Server by using a data source object in R or the **revoscalepy** library in Python, or by calling a stored procedure that contains the external script.
50-
51-
Whenever an external script is launched from SQL Server, the database engine security gets the security context of the user who started the job, and manages the mappings of the user or login to securable objects.
52-
53-
Therefore, all external scripts that are initiated from a remote client must specify the login or user information as part of the connection string.
33+
<a name="launchpad"></a>
5434

5535
## SQL Server Launchpad service
5636

‎docs/advanced-analytics/install/sql-machine-learning-services-windows-install.md‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,24 +224,18 @@ At the instance level, additional configuration might include:
224224
* [Enable additional network protocols](../../database-engine/configure-windows/enable-or-disable-a-server-network-protocol.md)
225225
* [Enable remote connections](../../database-engine/configure-windows/configure-the-remote-access-server-configuration-option.md)
226226
227-
On the database, you might need the following configuration updates:
228-
229-
* [Extend built-in permissions to remote users](#bkmk_configureAccounts)
230-
* [Grant permission to run external scripts](#permissions-external-script)
231-
* [Grant access to individual databases](#permissions-db)
232-
233-
> [!NOTE]
234-
> Whether additional configuration is required depends on your security schema, where you installed SQL Server, and how you expect users to connect to the database and run external scripts.
235-
236227
<a name="bkmk_configureAccounts"></a>
237228
<a name="permissions-external-script"></a>
238229
239-
For user security and connectivity, additional configuration might include:
230+
On the database, you might need the following configuration updates:
240231
241232
* [Security configuration for SQLRUserGroup](../../advanced-analytics/security/firewall-configuration.md)
242233
* [Give users permission to SQL Server Machine Learning Services](../../advanced-analytics/security/user-permission.md)
243234
* [Connect to SQL Server Machine Learning Services from your data science client computer](../../advanced-analytics/security/connect-from-client-computer.md)
244235
236+
> [!NOTE]
237+
> Whether additional configuration is required depends on your security schema, where you installed SQL Server, and how you expect users to connect to the database and run external scripts.
238+
245239
## Suggested optimizations
246240
247241
Now that you have everything working, you might also want to optimize the server to support machine learning, or install pretrained models.

‎docs/advanced-analytics/install/sql-r-services-windows-install.md‎

Lines changed: 8 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -183,86 +183,23 @@ If the external script verification step was successful, you can run Python comm
183183

184184
If you got an error when running the command, review the additional configuration steps in this section. You might need to make additional appropriate configurations to the service or database.
185185

186-
Common scenarios that require additional changes include:
186+
At the instance level, additional configuration might include:
187187

188-
* [Configure Windows firewall for in-bound connections](../../database-engine/configure-windows/configure-a-windows-firewall-for-database-engine-access.md)
188+
* [Firewall configuration for SQL Server Machine Learning Services](../../advanced-analytics/security/firewall-configuration.md)
189189
* [Enable additional network protocols](../../database-engine/configure-windows/enable-or-disable-a-server-network-protocol.md)
190190
* [Enable remote connections](../../database-engine/configure-windows/configure-the-remote-access-server-configuration-option.md)
191-
* [Extend built-in permissions to remote users](#bkmk_configureAccounts)
192-
* [Grant permission to run external scripts](#bkmk_AllowLogon)
193-
* [Grant access to individual databases](#permissions-db)
194-
195-
> [!NOTE]
196-
> Not all the listed changes are required, and none might be required. Requirements depend on your security schema, where you installed SQL Server, and how you expect users to connect to the database and run external scripts. Additional troubleshooting tips can be found here: [Upgrade and installation FAQ](../r/upgrade-and-installation-faq-sql-server-r-services.md)
197191

198192
<a name="bkmk_configureAccounts"></a>
199-
200-
### Enable implied authentication for the Launchpad account group
201-
202-
During setup, some new Windows user accounts are created for running tasks under the security token of the [!INCLUDE[rsql_launchpad_md](../../includes/rsql-launchpad-md.md)] service. When a user sends an R script from an external client, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] activates an available worker account, maps it to the identity of the calling user, and runs the R script on behalf of the user. This new service of the database engine supports the secure execution of external scripts, called *implied authentication*.
203-
204-
You can view these accounts in the Windows user group **SQLRUserGroup**. By default, 20 worker accounts are created, which is usually more than enough for running R jobs.
205-
206-
However, if you need to run R scripts from a remote data science client and are using Windows authentication, you must grant these worker accounts permission to sign in to the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] instance on your behalf.
207-
208-
1. In [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], in Object Explorer, expand **Security**, right-click **Logins**, and select **New Login**.
209-
2. In the **Login - New** dialog box, select **Search**.
210-
3. Select the **Object Types** and **Groups** check boxes, and clear all other check boxes.
211-
4. Click **Advanced**, verify that the location to search is the current computer, and then click **Find Now**.
212-
5. Scroll through the list of group accounts on the server until you find one beginning with `SQLRUserGroup`.
213-
214-
+ The name of the group that's associated with the Launchpad service for the _default instance_ is always just **SQLRUserGroup**. Select this account only for the default instance.
215-
+ If you are using a _named instance_, the instance name is appended to the default name, `SQLRUserGroup`. Hence, if your instance is named "MLTEST", the default user group name for this instance would be **SQLRUserGroupMLTest**.
216-
5. Click **OK** to close the advanced search dialog box, and verify that you've selected the correct account for the instance. Each instance can use only its own Launchpad service and the group created for that service.
217-
6. Click **OK** once more to close the **Select User or Group** dialog box.
218-
7. In the **Login - New** dialog box, click **OK**. By default, the login is assigned to the **public** role and has permission to connect to the database engine.
219-
220193
<a name="bkmk_AllowLogon"></a>
221194

222-
### Give users permission to run external scripts
223-
224-
> [!NOTE]
225-
> If you use a SQL login for running R scripts in a SQL Server compute context, this step is not required.
226-
227-
If you installed [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] in your own instance, you are usually executing scripts as an administrator, or at least as a database owner, and thus have implicit permissions for various operations, all data in the database, and the ability to install new packages as needed.
228-
229-
However, in an enterprise scenario, most users, including users who access the database by using SQL logins, do not have such elevated permissions. Therefore, for each user who will be running R scripts, you must grant the user permissions to run scripts in each database where external scripts will be used.
195+
On the database, you might need the following configuration updates:
230196

231-
```SQL
232-
USE <database_name>
233-
GO
234-
GRANT EXECUTE ANY EXTERNAL SCRIPT TO [UserName]
235-
```
197+
* [Security configuration for SQLRUserGroup](../../advanced-analytics/security/firewall-configuration.md)
198+
* [Give users permission to SQL Server Machine Learning Services](../../advanced-analytics/security/user-permission.md)
199+
* [Connect to SQL Server Machine Learning Services from your data science client computer](../../advanced-analytics/security/connect-from-client-computer.md)
236200

237-
> [!TIP]
238-
> Need help with setup? Not sure you have run all the steps? Use these custom reports to check installation status and run additional steps.
239-
>
240-
> [Monitor Machine Learning Services using Custom Reports](../r/monitor-r-services-using-custom-reports-in-management-studio.md).
241-
242-
<a name="permissions-db"></a>
243-
244-
### Give your users read, write, or DDL permissions to the database
245-
246-
The user account that is used to run R might need to read data from other databases, create new tables to store results, and write data into tables. Therefore, for each user who will be executing R scripts, ensure that the user has the appropriate permissions on the database: *db_datareader*, *db_datawriter*, or *db_ddladmin*.
247-
248-
For example, the following [!INCLUDE[tsql](../../includes/tsql-md.md)] statement gives the SQL login *MySQLLogin* the rights to run T-SQL queries in the *RSamples* database. To run this statement, the SQL login must already exist in the security context of the server.
249-
250-
```SQL
251-
USE RSamples
252-
GO
253-
EXEC sp_addrolemember 'db_datareader', 'MySQLLogin'
254-
```
255-
256-
For more information about the permissions included in each role, see [Database-level roles](../../relational-databases/security/authentication-access/database-level-roles.md).
257-
258-
259-
### Create an ODBC data source for the instance on your data science client
260-
261-
If you create an R solution on a data science client computer and need to run code by using the SQL Server computer as the compute context, you can use either a SQL login or integrated Windows authentication.
262-
263-
* For SQL logins: Ensure that the login has appropriate permissions on the database where you will be reading data. You can do so by adding *Connect to* and *SELECT* permissions, or by adding the login to the *db_datareader* role. For logins that need to create objects, add *DDL_admin* rights. For logins that must save data to tables, add the login to the *db_datawriter* role.
264-
265-
* For Windows authentication: You might need to configure an ODBC data source on the data science client that specifies the instance name and other connection information. For more information, see [ODBC data source administrator](https://docs.microsoft.com/sql/odbc/admin/odbc-data-source-administrator).
201+
> [!NOTE]
202+
> Not all the listed changes are required, and none might be required. Requirements depend on your security schema, where you installed SQL Server, and how you expect users to connect to the database and run external scripts. Additional troubleshooting tips can be found here: [Upgrade and installation FAQ](../r/upgrade-and-installation-faq-sql-server-r-services.md)
266203

267204
## Suggested optimizations
268205

‎docs/advanced-analytics/security/add-sqlrusergroup-to-database.md‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ manager: cgronlun
1515

1616
This article explains how to give the group of worker accounts used by machine learning services in SQL Server the permissions required to connect to the database and run R or Python jobs on behalf of the user.
1717

18-
## What is SQLRUserGroup?
18+
As part of the installation process for [!INCLUDE[rsql-productnamenew-md](../../includes/rsql-productnamenew-md.md)], a new Windows *user account pool* is created to support execution of tasks by the [!INCLUDE[rsql_launchpad](../../includes/rsql-launchpad-md.md)] service. The purpose of these worker accounts is to isolate concurrent execution of external scripts by different SQL users.
1919

20-
During setup of [!INCLUDE[rsql-productnamenew-md](../../includes/rsql-productnamenew-md.md)] or [!INCLUDE[rsql-productname-md](../../includes/rsql-productname-md.md)], new Windows user accounts are created to support execution of R or Python script tasks under the security token of the [!INCLUDE[rsql_launchpad_md](../../includes/rsql-launchpad-md.md)] service.
20+
For more information, see the Launchpad section in [Security overview](../../advanced-analytics/concepts/security.md#launchpad).
2121

22-
You can view these accounts in the Windows user group **SQLRUserGroup**. By default, 20 worker accounts are created, which is usually more than enough for running machine learning jobs.
22+
## Add SQLRUserGroup as a SQL Server login
2323

24-
When a user sends a machine learning script from an external client, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] activates an available worker account, maps it to the identity of the calling user, and runs the script on behalf of the user. This new service of the database engine supports the secure execution of external scripts, called *implied authentication*.
24+
By default, the group of worker accounts does **not** have login permissions on the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] instance with which it is associated. This can be a problem if any R or Python users connect to SQL Server from a remote client to run external scripts, or if a script uses ODBC to get additional data.
2525

26-
However, if you need to run R or Python scripts from a remote data science client, and you are using Windows authentication, you must give these worker accounts permission to sign in to the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] instance on your behalf.
26+
If you need to run scripts from a remote data science client, and you are using Windows authentication, additional configuration is required to give worker accounts running R and Python processes permission to sign in to the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] instance on your behalf.
2727

28-
## Add SQLRUserGroup as a SQL Server login
28+
> [!NOTE]
29+
> If you use a **SQL login** for running scripts in a SQL Server compute context, this extra step is not required.
2930
3031
1. In [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], in Object Explorer, expand **Security**, right-click **Logins**, and select **New Login**.
3132

@@ -67,4 +68,4 @@ If you intend to make heavy use of machine learning, you can increase the number
6768

6869
+ [Modify the user account pool for machine learning](../../advanced-analytics/administration/modify-user-account-pool.md)
6970

70-
By default, 20 accounts are created, which supports 20 concurrent sessions. Parallelized tasks do not consume additional accounts. For example, if a user runs a scoring task that uses parallel processing, the same worker account is reused for all threads.
71+
By default, 20 accounts are created, which supports 20 concurrent sessions. Parallelized tasks do not consume additional accounts. For example, if a user runs a scoring task that uses parallel processing, the same worker account is reused for all threads.

‎docs/advanced-analytics/security/connect-from-client-computer.md‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)