forked from NuGet/NuGetGallery
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Deploy-StaticContent.ps1
24 lines (20 loc) · 979 Bytes
/
Deploy-StaticContent.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
[CmdletBinding(DefaultParameterSetName='RegularBuild')]
param (
[string]$StorageAccountName,
[string]$StorageAccountKey,
[string]$Environment
)
Write-Host "Uploading static $Environment gallery content to $StorageAccountName."
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\Microsoft.WindowsAzure.StorageClient.dll")
$account = [Microsoft.WindowsAzure.CloudStorageAccount]::Parse("DefaultEndpointsProtocol=https;AccountName=$StorageAccountName;AccountKey=$StorageAccountKey")
$client = [Microsoft.WindowsAzure.StorageClient.CloudStorageAccountStorageClientExtensions]::CreateCloudBlobClient($account)
$files = Get-ChildItem ".\content\$Environment"
foreach ($file in $files) {
$blob = $client.GetBlockBlob("content/$file")
try {
$snappy = $blob.CreateSnapshot()
Write-Host "Created snapshot of existing 'content/$file'."
} catch {}
$blob.UploadFile($file.FullName)
Write-Host "Uploaded 'content/$file'."
}