param( [byte[]] $InputBlob, $TriggerMetadata ) Write-Host "PowerShell Blob Trigger Function executed" Write-Host "Blob Name: $($TriggerMetadata.Name)" Write-Host "Blob Size: $($InputBlob.Length) bytes" # Source Storage Account $sourceURI = "" $sourceContainer = "" $sourceSASToken = "?" # Destination Storage Account $destinationURI = "" $destinationContainer = "" $destinationSASToken = "?" # Construct the full paths while maintaining folder structure $blobRelativePath = $TriggerMetadata.Name # Keeps full folder path + filename $sourceFullPath = "$sourceURI/$sourceContainer/$blobRelativePath$sourceSASToken" $destinationFullPath = "$destinationURI/$destinationContainer/$blobRelativePath$destinationSASToken" # Check if AzCopy exists $AzCopyExists = Test-Path "azcopy.exe" Write-Host "AzCopy exists: $AzCopyExists" # Download and extract AzCopy if not present If ($AzCopyExists -eq $False){ Write-Host "AzCopy not found! Downloading..." Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile AzCopy.zip -UseBasicParsing Write-Host "Unzip AzCopy.zip" Expand-Archive ./AzCopy.zip ./AzCopy -Force Get-ChildItem ./AzCopy/*/azcopy.exe | Copy-Item -Destination "./AzCopy.exe" } # Copy the blob while maintaining its folder structure Write-Host "Copying blob from $sourceFullPath to $destinationFullPath" ./azcopy.exe copy "$sourceFullPath" "$destinationFullPath" --recursive=true