The network path cannot be found SSIS File System Task - sql-server

I am trying to upload a File onto the Sharepoint using a File System Task. When I run the package manually, it succeeds.
However, after I deploy it and run via SQL Agent Job I get the following error:
"The network path was not found"
Can you please help?

When you run it locally you are using your windows credentials to authenticate through to the sharepoint site. A sql job will not use your windows credentials. You can setup a proxy account, but make sure it has permissions to the sharepoint site as well.

Related

Azure DevOps Pipeline Azure SQL Deploy won't work with SQL script (Failed to login)

I've been trying to deploy a database via a pipeline from Azure DevOps to an Azure resource group.
I have an ARM template for my database server in my Repo along with my DACPAC file.
In my release pipeline I first deploy the database server with an admin user defined in the ARM template to my resource group.
Then I use the "Azure SQL DacpacTask" to deploy the database schema. Here I give the admin credentials and it works flawlessly.
The issue is that the customer doesn't want it deployed as a DACPAC but rather an SQL script. They've given me a "CREATE TO..."-script from their database, created inside MS SQL Studio, which is also in my Repo.
The "Azure SQL DacpacTask" inside my release pipeline has an option for using an SQL file instead of DACPAC, but it doesn't work for me.
But no matter how I do it, my pipeline fails when running the "Azure SQL DacpacTask" and all I get, even in debug-mode is "Login failed for user '***'".
I can connect to the SQL Server through MSSQL Studio on my local machine using the admin credentials defined in my ARM template.
I've tried by adding the agent's IP before running the SQL script, but with no success.
Can anyone point me in the right direction or maybe tell me what I'm doing wrong? Why is it that it keeps failing to log in?
They want it deployed with little to no human interaction. Is it doable only through the ADO pipeline?
EDIT
Additional info:
I have tried with hardcoded password and user with no luck.
If I manually create a database and then try to deploy one via script and pipeline, it fails because a database already exists, and not because of a failed login.
I've setup Audit in Azure which generates 2 files with little to no info. I'm not sure what I'm looking at.

Azure Devops deploying web app to a server - how to also update database

We have a web app which due to budgetary reasons is running on a windows VM (IIS) with its database also running in SQL Server on the same server.
We have a build pipeline set up in Azure Devops which builds the web app and then creates an idempotent SQL migration file (We use Entity Framework), both the compiled app and the SQL file are copied into the build artefact.
We then have a release pipeline which deploys the web app into IIS on the server.
What I cant figure out is how to get the SQL file run into the database.
I have tried the "SQL Database Deploy" task but that seems to only want a .dacpac file, or the path of a SQL file which is already on the server - I dont seem to be able to give it a file that exists on the build machine to execute remotely.
I know that because we are using EF I could just make the application do its migrations on startup but that means that the app needs to run as a user with schema privileges which we don't really want, currently the app is only a data reader/writer.
Is there some mechanism that I can take the SQL script from the build artefact and run it on the remote VM? If not, what are my options for getting the file onto the VM so that I can run it using the "SQL Database Deploy" task? I don't want to deploy it with the web app as although its a small risk we don't want it lingering in a public folder.
Any help appreciated.

SSIS job is not able to access the Azure File share path

I am testing the azure file share with SSIS hosted on Azure VM. However, I am facing an issue while running the job.
Package execution through Visual Studio is successful
Package execution through catalog also is successful
Package execution through the Job is FAILING with the error The File Name "\.windows.net<FolderName>\file.csv" specified in the connection was not valid
I tried running the job with the proxy account having access to the Azure share folder (Same account used to run the package), however it failed with the same error.
Both UNC and as a mapped drive was tested.
Any suggestion or advice on this will be highly appreciated.
Thanks in advance.
Try giving read/write permissions (For the Azure share folder) to the SQL Database Engine Service account NT SERVICE\MSSQL$<Instance Name> and NT SERVICE\SQLSERVERAGENT (Where <Instance Name> should be replaced by the installed instance name):
Configure File System Permissions for Database Engine Access
Also, feel free to read more about SQL Server service accounts in the following documentation:
Configure Windows Service Accounts and Permissions

SSIS - SharePoint - Network Path Not Found

I'm using SSIS to upload a PDF from SSRS into a SharePoint 2010 library. When I run the package in SSDT, it uploads as intended. However, when I deploy to the SSIS Catalog and run the package using a proxy account under SQL Server Agent, I receive the following error:
Network path was not found
I have verified my proxy account can post to the SharePoint site as the permissions are set up correctly. My belief is SSIS is not even trying to authenticate with the SharePoint site (maybe trying to connect anonymously?).
The code that uploads the PDF is located below. It authenticates the user to SSRS successfully, but not to SharePoint. The path that it uploads to is a UNC path. How do I get it to authenticate to a UNC path? A thought was to map a drive but that seems like a hack and may not be as reliable.
Dim httpCon As ConnectionManager = Dts.Connections("DDM Report Server")
Dim clientConn As HttpClientConnection = New HttpClientConnection(httpCon.AcquireConnection(Nothing))
clientConn.ServerURL = Dts.Variables("$Package::DDM_ReportServer").Value.ToString() & Dts.Variables("Report_Filename").Value.ToString()
clientConn.DownloadFile(Dts.Variables("$Package::SharePoint_Delivery_Location").Value.ToString() & Dts.Variables("PDF_Name").Value.ToString(), True)
I finally figured this out yesterday. Hannover First, you were onto something. In SSIS, you use WebClient within a script task to authenticate to the SharePoint site using the URL instead of the UNC Path. WebClient has everything you need to authenticate.

SQL Agent Run SSIS package as Administrator

I'm trying to run a SQL Agent Job with a step that is a SSIS File, and I need this step to be run as administrator.
My Package uses a Script task to download a file, as a Browser i Use WATIN.
I'm using a thread to start this browser because this browser control requires the thread to be set as Single-Threaded Apartment.
This browser control is requiring to be run as administrator.
I've already created a Credential for a user that is Windows Admin, a Proxy SSIS account. (SQL Agent user is not windows admin).
But the SSIS package is not run as administrator yet.
I'm suspecting this is related to UAC.
Some details:
SQL Agent Account is not Windows Administrator
Using Windows Server 2008 R2
My Package is run from the File System.
The Package only works on BIDS if I run it as an Administrator (if not admin doesn't work)
The Proxy account the job step is configured to run is windows admin.
Any help is appreciated!
Take a look at SSIS runs in BIDS but not with SQL Agent for some ideas
I've solved this in another way, The problem wasn't related to running the package as administrator, but creating a windows and setting focus to it, however I had the option to see the result file on the web page and I managed to use it, without downloading it, thus not needing to set focus on the download windows.
Thanks for all the help.
Try to add the user account in SSIS administrator group which can solve your problem.

Resources