-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAzCopy-Wrapper.ps1
29 lines (22 loc) · 1.07 KB
/
AzCopy-Wrapper.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
param(
[string] $SourceFolder = ".\test-images",
[string] $StorageAccount = "storterraformd01",
[string] $StorageContainer = "azcopycontainer",
[string] $SasToken = $env:SAS_TOKEN,
[string] $TargetFolderPrefix = "from-powershell"
)
Set-Location $PSScriptRoot
$SourceFolderAbsPath = (Get-Item $SourceFolder).FullName
Write-Host "Source folder Abs Path: $SourceFolderAbsPath"
$SourceFolderForAzCopy = "$SourceFolderAbsPath/*"
Write-Host "Source folder for Az Copy: $SourceFolderForAzCopy"
$TargetUrl = "https://$StorageAccount.blob.core.windows.net/$StorageContainer/$TargetFolderPrefix`?$SasToken"
Write-Host "Target prfix: $TargetFolderPrefix"
Write-Host "Target url: $TargetUrl"
azcopy copy "$SourceFolderForAzCopy" "$TargetUrl" --recursive=true
# example of call
#.\upload-to-azure.ps1 -SourceFolder "C:\Users\YourUser\test-images" `
# -StorageAccount "storterraformd01" `
# -StorageContainer "azcopycontainer" `
# -SasToken $env:SAS_TOKEN `
# -TargetFolderPrefix "from-powershell"