Skip to content

Instantly share code, notes, and snippets.

@rprakashg
Created May 20, 2015 21:53
Show Gist options
  • Save rprakashg/0bdf31c634ab9f1e8967 to your computer and use it in GitHub Desktop.
Save rprakashg/0bdf31c634ab9f1e8967 to your computer and use it in GitHub Desktop.
Upload file to Azure Blob Storage
param(
[string] $Source,
[string] $FileToUpload,
[string] $StorageAccountName,
[string] $StorageContainerName,
[string] $AzCopyPath
)
$StorageAccountKey = (Get-AzureStorageKey -StorageAccountName $StorageAccountName).Primary
$StorageAccountContext = New-AzureStorageContext $StorageAccountName (Get-AzureStorageKey $StorageAccountName).Primary
$Dest = $StorageAccountContext.BlobEndPoint + $StorageContainerName
#use AzCopy to copy files into blob
& "$AzCopyPath" ""$Source"" ""$Dest"" ""$FileToUpload"" /DestKey:""$StorageAccountKey""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment