- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Powershell can't connect to Azure SQL when running Data Factory pipeline
I want to restore a database in Azure SQL using a PowerShell script in Data Factory. For this I have created a pipeline in Data Factory with a Custom Activity. I am connecting to a Batch account and a pool using System managed Identity and to a Storage account where I have the PowerShell script.
In the Pool Start Task I am running the following commands: powershell "Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; Install-Module AzAccounts -force; Set-ExecutionPolicy Unrestricted -Force ; install-module -name sqlserver -force -allowclobber ; import-module SqlServer;".
I am not sure which type of access needs to be given to the Batch Account or to ADF to be able to connect to Azure SQL (using System managed Identity).
Also, under Managed Linked Services in ADF I have a linked service to the Azure SQL database, but I don't know if I need this linked service and I don't know how to add it in the pipeline to be able to connect to Azure SQL.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
since you are using powershell script to access the Azure SQL database and powershell is being executed within Azure batch, it is the Azure batch that needs to have access on the Azure SQL database and not the ADF.
There is not even the need to create a linked service to Azure SQL DB from ADF as ADF is just there to trigger the Azure batch,
Also for ADF reletaed queries, plz use the below MSFT forum :
https://learn.microsoft.com/en-us/answers/tags/194/azure-data-factory?source=docs
----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
since you are using powershell script to access the Azure SQL database and powershell is being executed within Azure batch, it is the Azure batch that needs to have access on the Azure SQL database and not the ADF.
There is not even the need to create a linked service to Azure SQL DB from ADF as ADF is just there to trigger the Azure batch,
Also for ADF reletaed queries, plz use the below MSFT forum :
https://learn.microsoft.com/en-us/answers/tags/194/azure-data-factory?source=docs
----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for your answer. Still, I can't find anywhere how you can give Azure Batch tasks the ability to connect to an Azure SQL Database.
I will also post this on ADF related queries.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @icon2023 ,
Thanks for using Fabric Community.
Can you please share whether you are working with Azure Data Factory or Fabric Data Factory?
Unfortunately Fabric Community only supports fabric related issues, incase if you want to resolve your issue related to Azure Data Factory - please raise your issue here - Ask a question - Microsoft Q&A .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The question was related to Azure Data Factory.
I will also post it on ADF related queries.

Helpful resources
Join our Fabric User Panel
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Fabric Monthly Update - June 2025
Check out the June 2025 Fabric update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
02-09-2025 04:07 PM | |||
04-15-2025 08:27 AM | |||
03-11-2025 01:02 PM | |||
04-02-2025 03:18 AM | |||
03-22-2024 02:03 AM |
User | Count |
---|---|
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
2 |