SSIS job SQL login failed when using proxy and credentials - ssis

Problem: I cannot get the SSIS proxy and SQL credentials configured correctly to use a restricted access domain account (Domain\UserName) for a SQL Agent job step that runs an SSIS package. The Domain\UserName account has all the required permissions and privileges and the SSIS package is also designed correctly. I have read much material on this subject and would like some help in case I missed something.
More Details: I have an SSIS package which simply reads data from one SQL Server database table and pushes that data to another database table on a different server. I have got a special identity (Domain\UserName) created to perform this operation because this needs to be run on a daily basis.
Now everything runs perfectly fine when I run visual studio with that Domain\UserName and manually run that SSIS package. But it is not running when I deploy that to SSISDB. I have created SQL Server Security Credentials with same user account and created an SSIS Package Executing Proxy using that credential and configured the SQL Agent Job step to Run as that proxy account.
But It always gives the following error when I try to execute that SQL Agent Job Step:
Message
Executed as user: Domain\UserName. Microsoft (R) SQL Server Execute Package
Utility Version 11.0.6020.0 for 64-bit Copyright (C) Microsoft Corporation.
All rights reserved. Started: 10:00:26 AM Failed to execute IS server package
because of error 0x80131904. Server: XXXXXXXXXXXX, Package path: XXXXXXXXXX,
Environment reference Id: 36. Description: Login failed for user 'Domain\UserName'.
Source: .Net SqlClient Data Provider Started: 10:00:26 AM Finished: 10:00:26 AM
Elapsed: 0.578 seconds. The package execution failed. The step failed.

I found the issue. I missed one step to grant permission for Domain\UserName to use the proxy.
Explanation
You need to grant permissions to logins/roles who will be using the created proxy account using sp_grant_login_to_proxy system stored procedure. You can use sp_enum_login_for_proxy system stored procedure to view all the logins/roles who have access to the proxies.
Script - Granting proxy access to security principals :
USE msdb
GO
--Grant proxy account access to security principals that could be
--either login name or fixed server role or msdb role
--Please note, Members of sysadmin server role are allowed to use any proxy
EXEC msdb.dbo.sp_grant_login_to_proxy
#proxy_name=N'SSISProxyDemo'
,#login_name=N'Domain\UserName'
--,#fixed_server_role=N''
--,#msdb_role=N''
GO
--View logins provided access to proxies
EXEC dbo.sp_enum_login_for_proxy
GO

Related

Configure SQL Server Job with dtsx

I migrated from SQL Server 2008 to 2019. On the old server there is set up a job, which calls a dtsx file. It needs database access, file system access because it saves tmp files to disk, and internet conneciton to send this file.
The connection string is defined followings:
<DTS:ConnectionManager
DTS:ConnectionString="Provider=SQLOLEDB.1;Password=p#ssword;Persist Security Info=True;User ID=MyUser;Initial Catalog=MyDB;Data Source=SQLServer\Instance;" />
If I run it using the Execute Package Utility it works. If I run it through the SQLServer Job, I get the error that the user is not granted to access the file system. The owner of the job is the same I am logged in and run the package using the Utility.
In the history i see:
The job failed. The Job was invoked by User Domain\RightUser.....
where RightUser is the Owner (and same as before, the same user run the package using the utility)
but the second row of the error:
Executed as user: NT Service\SQLAgent$AnotherUser.
And I have no idea where this AnotherUser comes from.
Whats wrong?
Furthermore, I don't really like the hardcoded password in the connection string, If the job run in its owner context, should it work changing the connection string to Integrated Security=True;, right?
This is a very common problem with running SSIS packages. That other user is SQL Agent, which in reality runs the package (this is the default user running the steps in jobs). Job owner has got nothing to do with running the SSIS packages. SQL Agent user name is set during the SQL Server installation. If it's omitted, the installer creates automatically a username like you described.
To the second question, yes you are right. If the user, who executes the package, has the correct permissions to the SQL Server described in the connection string, the userid and password are unnecessary. But in your case, the package is run by the SQL Agent with NT Service -level username, so it might be impossible to add that username to the SQL Server. You should set up a proper username for running the SSIS package and set it as a proxy account to the SQL Server, like described here: https://community.spiceworks.com/how_to/129293-configure-an-ssis-package-to-execute-as-a-proxy-account

SSIS dynamic connectiong string via environment variable failed to execute

I want to test dynamic connection string in SSIS. Here were the steps that I already performed.
1) Created connection string.
2) Parameterizing connection string
3) Deploy SSIS Package to SSIS Catalog via Project deployment model
4) Setup environment variable in SSIS Catalog
5) Configure SSIS project to reference environment variable
Everything look goods but failed to execute the task.
SSIS Catalog
Project configuration
Error message
I think you should fix the issue with the steps below:
Create a Proxy account with permissions in SSISDB and the permissions needed for the db used in the package.
Create a credential in the SSIS server. The user and password are the same that the proxy account.
Use the proxy account to execute the project.
As per the screenshot, it looks like the package is failing due to login issue. Please check the login with which the package is running and it has correct access to DB Server.

Login Failed for User (Microsoft SQL Server, Error: 18456

I have SQL Server 2008 running on my local machine. I have removed myself from Database --> Sercurity. Now I cannot login and I am getting following error
Login Failed for User (Microsoft SQL Server, Error: 18456)
My Login is auttenticating from Active Directory
If you removed or disabled your login to the dmbs and have no other Logins to repair the situation, this Tip from a Microsoft Blog may apply:
Here are the steps you will need to perform:
Start the SQL Server instance using single user mode (or minimal configuration which will also put SQL Server in single user mode)
From the command prompt type: SQLServr.Exe –m (or SQLServr.exe –f)
Note: If the Binn folder is not in your environmental path, you’ll
need to navigate to the Binn folder.
(Usually the Binn folder is located at: C:\Program Files\Microsoft SQL
Server\MSSQL10.MSSQLSERVER\MSSQL\Binn)
Once SQL Server service has been started in single user mode or with minimal configuration, you can now use the SQLCMD command from
command prompt to connect to SQL Server and perform the following
operations to add yourself back as an Admin on SQL Server instance.
SQLCMD –S
You will now be logged in to SQL Server as an Admin.
Once you are logged into the SQL Server using SQLCMD, issue the following commands to create a new account or add an existing login to
SYSADMIN server role.
To create a new login and add that login to SYSADMIN server role:
1> CREATE LOGIN ‘’ with PASSWORD=’’
2> go
1> SP_ADDSRVROLEMEMBER '','SYSADMIN'
2>go
To add an existing login to SYSADMIN server role, execute the
following:
1> SP_ADDSRVROLEMEMBER ‘’,’SYSADMIN’
The above operation will take care of granting SYSADMIN privileges to
an existing login or to a new login.
Once the above steps are successfully performed, the next step is to stop and start SQL Server services using regular startup options.
(This time you will not need –f or –m)

Running SSIS package with linked server through a SQL Job

I have a SSIS 2008 package. In one of the Script task I am calling a stored procedure which is using Openquery using linked server. I deployed this package with protection level as "EncryptWithPassword" and gave a password to the package. Created a SQL job and edited its command line to include the password. If I login to SQL Server Mgmt Studio with Windows Authentication and run the job manually it runs fine. But when I schedule it then I get an error that "The Communication link to Linked server failed".
Please help
Most likely that you launch job from default Run as login.
You should create credential with your login, so package will have access and priveleges to linked database under your login.
You may read this article for better explanation.

SSIS Package not executed by SQL Server Agent using password or xml config or table config

I have an SSIS package that takes data from a MySQL database and puts it in to a SQL Server table. The connection to MySQL is ADO.net. The package runs fine in BIDS.
I would like to deploy the package to be run as a Job on SQL Server 2008. The MySQL connection requires sensitive data to be either stored within the package or held in some external configuration source. If it is stored within the package it will either by encrypted with a key specific to my windows user profile or must be protected via a password.
I have tried three methods of setting up a SQL Server Agent job to execute this pacakge, and all fail:
Using a Password
I set the ProtectionLevel of the package to EncryptSensitiveWithPassword and supply a password for the package. I then save a copy of the package to the msdb. I can then connect to SSIS and run the package, at which point I am prompted for a password.
When I try to schedule this as a job in SQL Server I am prompted to enter the password by clicking on the Configurations tab of the Job Step Properties and I can see that the /DECRYPT switch has been added to the Command Line tab. The Run As property is set to the SQL Server Agent Service Account, which is mapped to a database login that has sysadmin server role. When I attempt to start this job I get the following error:
Executed as user: DOMAIN\UserROLE. Microsoft (R) SQL Server Execute Package Utility Version 10.0.5500.0 for 64-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 12:31:30 Error: 2012-07-03 12:31:31.20 Code: 0xC00291EC Source: Get Data Execute SQL Task Description: Failed to acquire connection "DATA_SOURCE". Connection may not be configured correctly or you may not have the right permissions on this connection. End Error DTExec: The package execution returned DTSER_FAILURE
It seems that using this method the package password itself is not stored anywhere for the job to access it.
Using an XML configuration file
I then created a copy of the package and set the ProtectionLevel to DontSaveSensitive and I set up a package configuration to store the MySQL credentials in an XML file. I then save this to the msdb and then when I run the package from
Integration Services I can provide a path to the config file, and all is well. However, once again when I set up a job for the package I point to a configuration file on the server but the job fails with the same error. I am wondering whether this is because the SQL Server Agent does not have an associated windows account that would allow it to read from the XML file stored in the file system.
Using a SQL Server table configuration
This time I created a copy of the package and set the ProtectionLevel to ServerStorage. I then created a [SSIS Configurations] table in the target SQL Server database. I modified the entries in this table to contain the password for the MySQL data source. Again, the package runs successfully from Integration Services, but fails with the same error as previously when run from a job. I have checked that the SQL Server Agent is able to read from the [SSIS Configurations] table ok - I set up a standalone job to test this.
Does anyone have any suggestions about what else I should do here?
I am thinking of giving up on SQL Server Agent Jobs for this and going back to having the package scheduled simply by the windows scheduler but thought before throwing in the towel I would try here first.
I am using the method of encrypting the password by setting EncryptSensitiveWithPassword as you discribed above and don't see anything you do wrong. Remember to use option keep protection level of the original package when importing the package with integration services, but it looks like you're doing that, too.
Try setting the role SQLAgentOperatorRole to your SQL Server Agent Service Account, you didn't mention that and i am not sure if you did. This could possibly solve your permission problems. (liked to answer by commenting this, but i lack of permissions here, too :)