'SSIS execute process task with powershell
I am trying to write files to Azure File Share using the unc path. The script runs as expected when run interactively. But, when run from the SSIS execute process task it errors out and I am not able to see the error message. I am assigning a variable to the StandardErrorVariable, still unable to capture the actual error message. For instance, I am using the below code.
I doubt my error is due to unable to find the required modules on Azure File Share. If I were to reference the required package modules how do I custom load them from the Azure File Share?
Also, how to capture error messages when executed from within the SSIS execute process task?
I have the powershell executable & script saved on File Share.
"\\storacname.file.core.windows.net\posh\exe\powershell.exe"
"\\storacname.file.core.windows.net\posh\script\posh.ps1"
Tried the below powershell code and none seem to work.
PoSh:
#Add-Type -Path '\\storacname.file.core.windows.net\posh\exe\Modules\Az.Accounts\2.7.6\Az.Accounts.psd1'
$env:PoShModulePath = $env:PoShModulePath,'\\storacname.file.core.windows.net\posh\exe\Modules' -join [System.IO.Path]::PathSeparator
Import-Module Az
try {
Connect-AzAccount -Subscription "sub_name"
}
catch {
"ERROR - Unable to connect to azure subscription"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|