How to access the script stored(.sql) in azure blob from MI agent job step

Rishi 21 Reputation points
2021-10-05T15:10:02.9+00:00

Hello,

I wanted to execute script T-SQL script stored in AZ file share is it possible to accomplish if not can we do the same if scripts are stored in AZ blob storage, pls suggest.

Many thanks in advance

Azure SQL Database
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
672 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saurabh Sharma 23,791 Reputation points Microsoft Employee
    2021-10-06T23:57:46.27+00:00

    Hi @Rishi ,

    Thanks for using Microsoft Q&A !!
    You cannot directly use Azure MI agent job step to connect to an Azure File Share. You have to either create a custom OS script or PowerShell script which could connect to Azure File Share or a blob to fetch the script to execute it. Please refer to - Create a CmdExec Job Step and Run Windows PowerShell Steps in SQL Server Agent for configuring your job agent to use CMDExec or PowerShell steps.
    Please refer to Download a file to download the content of the file from Azure File Share using PowerShell or Azure CLI.

    Please let me know if you have any questions.

    Thanks
    Saurabh