Error passing Azure File Share to Set-Location cmdlet

Charlotte Watson 21 Reputation points
2021-04-14T17:22:28.467+00:00

I am attempting to automate a copy file process using an Azure Runbook.
Here's the code:
![87886-image.png]1

What am I doing wrong here?

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,163 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,114 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,381 Reputation points
    2021-04-15T14:13:04.157+00:00

    Hi @Charlotte Watson ,

    AFAIK you would have to download the files under file share to $env:temp location and then upload them to S3 bucket from that location.

    Below is a sample runbook with the part to download the file under file share to $env:temp location:

    $context = New-AzStorageContext -StorageAccountName "<StorageAccountName>" -StorageAccountKey "<StorageAccessKey>"  
    $StorageShare = Get-AzStorageShare -Name "<FileShareName>" –Context $context  
    Get-AzStorageFileContent –Share $StorageShare –Path "<FileName>" -Destination ($Env:temp)  
    Test-Path -Path ($Env:temp+"/Test.csv")  
    

    88301-image.png

    88282-image.png

    88238-image.png

    Note that to use cmdlets provided in the above sample runbook approach, you would have to make sure that Az.Storage module is installed in your Azure Automation account.

    0 comments No comments