question

CharlotteWatson-8441 avatar image
0 Votes"
CharlotteWatson-8441 asked tbgangav-MSFT answered

Error passing Azure File Share to Set-Location cmdlet

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-filesazure-automation
image.png (57.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered

Hi @CharlotteWatson-8441,

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.


image.png (30.1 KiB)
image.png (46.0 KiB)
image.png (42.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.