|
| 1 | +--- |
| 2 | +title: Access data stores and file shares with Windows authentication |
| 3 | +description: Learn how to configure SSIS catalog in Azure SQL Database and Azure-SSIS Integration Runtime in Azure Data Factory to run packages that access data stores and file shares with Windows authentication. |
| 4 | +ms.date: "3/22/2018" |
| 5 | +ms.topic: conceptual |
| 6 | +ms.prod: sql |
| 7 | +ms.prod_service: "integration-services" |
| 8 | +ms.custom: "" |
| 9 | +ms.technology: integration-services |
| 10 | +author: swinarko |
| 11 | +ms.author: sawinark |
| 12 | +ms.reviewer: maghan |
| 13 | +--- |
| 14 | + |
| 15 | +# Access data stores and file shares with Windows authentication from SSIS packages in Azure |
| 16 | + |
| 17 | +You can use Windows authentication to access data stores, such as SQL Servers, file shares, Azure Files, etc. from SSIS packages running on your Azure-SSIS Integration Runtime (IR) in Azure Data Factory (ADF). Your data stores can be on premises, hosted on Azure Virtual Machines (VMs), or running in Azure as managed services. If they are on premises, you need to join your Azure-SSIS IR to a Virtual Network (Microsoft Azure Virtual Network) connected to your on-premises network, see [Join Azure-SSIS IR to a Microsoft Azure Virtual Network](https://docs.microsoft.com/azure/data-factory/join-azure-ssis-integration-runtime-virtual-network). There are four methods to access data stores with Windows authentication from SSIS packages running on your Azure-SSIS IR: |
| 18 | + |
| 19 | +| Connection method | Effective scope | Setup step | Access method in packages | Number of credential sets and connected resources | Type of connected resources | |
| 20 | +|---|---|---|---|---|---| |
| 21 | +| Setting up an activity-level execution context | Per Execute SSIS Package activity | Configure the **Windows authentication** property to set up an "Execution/Run as" context when running SSIS packages as Execute SSIS Package activities in ADF pipelines.<br/><br/> For more info, see [Configure Execute SSIS Package activity](https://docs.microsoft.com/azure/data-factory/how-to-invoke-ssis-package-ssis-activity). | Access resources directly in packages via UNC path, for example, if you use file shares or Azure Files: `\\YourFileShareServerName\YourFolderName` or `\\YourAzureStorageAccountName.file.core.windows.net\YourFolderName` | Support only one credential set for all connected resources | - File shares on premises/Azure VMs<br/><br/> - Azure Files, see [Use an Azure file share](https://docs.microsoft.com/azure/storage/files/storage-how-to-use-files-windows) <br/><br/> - SQL Servers on premises/Azure VMs with Windows authentication<br/><br/> - Other resources with Windows authentication | |
| 22 | +| Setting up a catalog-level execution context | Per Azure-SSIS IR, but is overridden when setting up an activity-level execution context (see above) | Execute SSISDB `catalog.set_execution_credential` stored procedure to set up an "Execution/Run as" context.<br/><br/> For more info, see the rest of this article below. | Access resources directly in packages via UNC path, for example, if you use file shares or Azure Files: `\\YourFileShareServerName\YourFolderName` or `\\YourAzureStorageAccountName.file.core.windows.net\YourFolderName` | Support only one credential set for all connected resources | - File shares on premises/Azure VMs<br/><br/> - Azure Files, see [Use an Azure file share](https://docs.microsoft.com/azure/storage/files/storage-how-to-use-files-windows) <br/><br/> - SQL Servers on premises/Azure VMs with Windows authentication<br/><br/> - Other resources with Windows authentication | |
| 23 | +| Persisting credentials via `cmdkey` command | Per Azure-SSIS IR, but is overridden when setting up an activity/catalog -level execution context (see above) | Execute `cmdkey` command in a custom setup script (`main.cmd`) when provisioning your Azure-SSIS IR, e.g., if you use file shares or Azure Files: `cmdkey /add:YourFileShareServerName /user:YourDomainName\YourUsername /pass:YourPassword` or `cmdkey /add:YourAzureStorageAccountName.file.core.windows.net /user:azure\YourAzureStorageAccountName /pass:YourAccessKey`.<br/><br/> For more info, see [Customize setup for Azure-SSIS IR](https://docs.microsoft.com/azure/data-factory/how-to-configure-azure-ssis-ir-custom-setup). | Access resources directly in packages via UNC path, for example, if you use file shares or Azure Files: `\\YourFileShareServerName\YourFolderName` or `\\YourAzureStorageAccountName.file.core.windows.net\YourFolderName` | Support multiple credential sets for different connected resources | - File shares on premises/Azure VMs<br/><br/> - Azure Files, see [Use an Azure file share](https://docs.microsoft.com/azure/storage/files/storage-how-to-use-files-windows) <br/><br/> - SQL Servers on premises/Azure VMs with Windows authentication<br/><br/> - Other resources with Windows authentication | |
| 24 | +| Mounting drives at package execution time (non-persistent) | Per package | Execute `net use` command in Execute Process Task that is added at the beginning of control flow in your packages, for example, `net use D: \\YourFileShareServerName\YourFolderName` | Access file shares via mapped drives | Support multiple drives for different file shares | - File shares on premises/Azure VMs<br/><br/> - Azure Files, see [Use an Azure file share](https://docs.microsoft.com/azure/storage/files/storage-how-to-use-files-windows) | |
| 25 | +||||||| |
| 26 | + |
| 27 | +> [!WARNING] |
| 28 | +> If you do not use any of the above methods to access data stores with Windows authentication, your packages that depend on Windows authentication are not able to access them and fail at run time. |
| 29 | +
|
| 30 | +The rest of this article describes how to configure SSIS catalog (SSISDB) hosted in Azure SQL Database server/Managed Instance to run packages on Azure-SSIS IR that use Windows authentication to access data stores. |
| 31 | + |
| 32 | +## You can only use one set of credentials |
| 33 | + |
| 34 | +When you use Windows authentication in an SSIS package, you can only use one set of credentials. The domain credentials that you provide when you follow the steps in this article apply to all package executions - interactive or scheduled - on your Azure-SSIS IR until you change or remove them. If your package has to connect to multiple data stores with different sets of credentials, you should consider the above alternative methods. |
| 35 | + |
| 36 | +## Provide domain credentials for Windows authentication |
| 37 | + |
| 38 | +To provide domain credentials that let packages use Windows authentication to access data stores on premises, do the following things: |
| 39 | + |
| 40 | +1. With SQL Server Management Studio (SSMS) or another tool, connect to Azure SQL Database server/Managed Instance that hosts SSISDB. For more info, see [Connect to SSISDB in Azure](https://docs.microsoft.com/sql/integration-services/lift-shift/ssis-azure-connect-to-catalog-database). |
| 41 | + |
| 42 | +2. With SSISDB as the current database, open a query window. |
| 43 | + |
| 44 | +3. Run the following stored procedure and provide the appropriate domain credentials: |
| 45 | + |
| 46 | + ```sql |
| 47 | + catalog.set_execution_credential @user='<your user name>', @domain='<your domain name>', @password='<your password>' |
| 48 | + ``` |
| 49 | + |
| 50 | +4. Run your SSIS packages. The packages use the credentials that you provided to access data stores on premises with Windows authentication. |
| 51 | + |
| 52 | +### View domain credentials |
| 53 | + |
| 54 | +To view the active domain credentials, do the following things: |
| 55 | + |
| 56 | +1. With SSMS or another tool, connect to Azure SQL Database server/Managed Instance that hosts SSISDB. For more info, see [Connect to SSISDB in Azure](https://docs.microsoft.com/sql/integration-services/lift-shift/ssis-azure-connect-to-catalog-database). |
| 57 | + |
| 58 | +2. With SSISDB as the current database, open a query window. |
| 59 | + |
| 60 | +3. Run the following stored procedure and check the output: |
| 61 | + |
| 62 | + ```sql |
| 63 | + SELECT * |
| 64 | + FROM catalog.master_properties |
| 65 | + WHERE property_name = 'EXECUTION_DOMAIN' OR property_name = 'EXECUTION_USER' |
| 66 | + ``` |
| 67 | + |
| 68 | +### Clear domain credentials |
| 69 | +To clear and remove the credentials that you provided as described in this article, do the following things: |
| 70 | + |
| 71 | +1. With SSMS or another tool, connect to Azure SQL Database server/Managed Instance that hosts SSISDB. For more info, see [Connect to SSISDB in Azure](https://docs.microsoft.com/sql/integration-services/lift-shift/ssis-azure-connect-to-catalog-database). |
| 72 | + |
| 73 | +2. With SSISDB as the current database, open a query window. |
| 74 | + |
| 75 | +3. Run the following stored procedure: |
| 76 | + |
| 77 | + ```sql |
| 78 | + catalog.set_execution_credential @user='', @domain='', @password='' |
| 79 | + ``` |
| 80 | + |
| 81 | +## Connect to a SQL Server on premises |
| 82 | + |
| 83 | +To check whether you can connect to a SQL Server on premises, do the following things: |
| 84 | + |
| 85 | +1. To run this test, find a non-domain-joined computer. |
| 86 | + |
| 87 | +2. On the non-domain-joined computer, run the following command to start SSMS with the domain credentials that you want to use: |
| 88 | + |
| 89 | + ```cmd |
| 90 | + runas.exe /netonly /user:<domain>\<username> SSMS.exe |
| 91 | + ``` |
| 92 | + |
| 93 | +3. From SSMS, check whether you can connect to the SQL Server on premises. |
| 94 | + |
| 95 | +### Prerequisites |
| 96 | + |
| 97 | +To access a SQL Server on premises from packages running in Azure, do the following things: |
| 98 | + |
| 99 | +1. In SQL Server Configuration Manager, enable TCP/IP protocol. |
| 100 | + |
| 101 | +2. Allow access through Windows firewall. For more info, see [Configure Windows firewall to access SQL Server](https://docs.microsoft.com/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access). |
| 102 | + |
| 103 | +3. Join your Azure-SSIS IR to a Microsoft Azure Virtual Network that is connected to the SQL Server on premises. For more info, see [Join Azure-SSIS IR to a Microsoft Azure Virtual Network](https://docs.microsoft.com/azure/data-factory/join-azure-ssis-integration-runtime-virtual-network). |
| 104 | + |
| 105 | +4. Use SSISDB `catalog.set_execution_credential` stored procedure to provide credentials as described in this article. |
| 106 | + |
| 107 | +## Connect to a file share on premises |
| 108 | + |
| 109 | +To check whether you can connect to a file share on premises, do the following things: |
| 110 | + |
| 111 | +1. To run this test, find a non-domain-joined computer. |
| 112 | + |
| 113 | +2. On the non-domain-joined computer, run the following commands. These commands open a command prompt window with the domain credentials that you want to use and then test connectivity to the file share on premises by getting a directory listing. |
| 114 | + |
| 115 | + ```cmd |
| 116 | + runas.exe /netonly /user:<domain>\<username> cmd.exe |
| 117 | + dir \\fileshare |
| 118 | + ``` |
| 119 | + |
| 120 | +3. Check whether the directory listing is returned for the file share on premises. |
| 121 | + |
| 122 | +### Prerequisites |
| 123 | + |
| 124 | +To access a file share on premises from packages running in Azure, do the following things: |
| 125 | + |
| 126 | +1. Allow access through Windows firewall. |
| 127 | + |
| 128 | +2. Join your Azure-SSIS IR to a Microsoft Azure Virtual Network that is connected to the file share on premises. For more info, see [Join Azure-SSIS IR to a Microsoft Azure Virtual Network](https://docs.microsoft.com/azure/data-factory/join-azure-ssis-integration-runtime-virtual-network). |
| 129 | + |
| 130 | +3. Use SSISDB `catalog.set_execution_credential` stored procedure to provide credentials as described in this article. |
| 131 | + |
| 132 | +## Connect to a file share on Azure VM |
| 133 | + |
| 134 | +To access a file share on Azure VM from packages running in Azure, do the following things: |
| 135 | + |
| 136 | +1. With SSMS or another tool, connect to Azure SQL Database server/Managed Instance that hosts SSISDB. For more info, see [Connect to SSISDB in Azure](https://docs.microsoft.com/sql/integration-services/lift-shift/ssis-azure-connect-to-catalog-database). |
| 137 | + |
| 138 | +2. With SSISDB as the current database, open a query window. |
| 139 | + |
| 140 | +3. Run the following stored procedure and provide the appropriate domain credentials: |
| 141 | + |
| 142 | + ```sql |
| 143 | + catalog.set_execution_credential @domain = N'.', @user = N'username of local account on Azure virtual machine', @password = N'password' |
| 144 | + ``` |
| 145 | + |
| 146 | +## Connect to a file share in Azure Files |
| 147 | + |
| 148 | +For more info about Azure Files, see [Azure Files](https://azure.microsoft.com/services/storage/files/). |
| 149 | + |
| 150 | +To access a file share in Azure Files from packages running in Azure, do the following things: |
| 151 | + |
| 152 | +1. With SSMS or another tool, connect to Azure SQL Database server/Managed Instance that hosts SSISDB. For more info, see [Connect to SSISDB in Azure](https://docs.microsoft.com/sql/integration-services/lift-shift/ssis-azure-connect-to-catalog-database). |
| 153 | + |
| 154 | +2. With SSISDB as the current database, open a query window. |
| 155 | + |
| 156 | +3. Run the following stored procedure and provide the appropriate domain credentials: |
| 157 | + |
| 158 | + ```sql |
| 159 | + catalog.set_execution_credential @domain = N'Azure', @user = N'<storage-account-name>', @password = N'<storage-account-key>' |
| 160 | + ``` |
| 161 | + |
| 162 | +## Next steps |
| 163 | + |
| 164 | +- Deploy your packages. For more info, see [Deploy an SSIS project to Azure with SSMS](https://docs.microsoft.com/sql/integration-services/ssis-quickstart-deploy-ssms). |
| 165 | +- Run your packages. For more info, see [Run SSIS packages in Azure with SSMS](https://docs.microsoft.com/sql/integration-services/ssis-quickstart-run-ssms). |
| 166 | +- Schedule your packages. For more info, see [Schedule SSIS packages in Azure](https://docs.microsoft.com/sql/integration-services/lift-shift/ssis-azure-schedule-packages-ssms?view=sql-server-ver15). |
0 commit comments