Search code examples
azurepowershellsftpazure-automationazure-runbook

downloading file from a SFTP server using Azure Runbook Powershell


How can I install Posh-SSH in a Runbook Powershell?

I need to download files from a SFTP server to Azure Disk using a Runbook Powershll. However there is no Powershell mothod for this and I need to install Posh-ssh module. When I execute Install-Module -Name Posh-SSH -Force inside my Runbook it generates following error:

Exception calling "ShouldContinue" with "2" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\Client\AppData\Roaming\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?"


Solution

  • You can import this module as per steps below:

    1.Go to your Automation account in azure portal.

    2.Under Shared Resources, select Modules.

    3.Select Add a module.

    4.Select the .zip file that contains your module.

    5.Select OK to start to import process.

    The official document is here. I also attach a screenshot of the progress here:

    enter image description here