Storage/Save-AppsToAzureStorage.ps1
<#
.Synopsis Function for publishing build output from Run-AlPipeline to storage account .Description Modified version of Freddy's https://github.com/microsoft/navcontainerhelper/blob/master/PackageHandling/Publish-BuildOutputToStorage.ps1 .Parameter StorageConnectionString A connectionstring with access to the storage account in which you want to publish artifacts (SecureString or String) .Parameter containerName Project name of the app you want to publish. This becomes part of the blob url. .Parameter destinationPath Path inside blob of the archive you want to publish. This becomes part of the blob url. .Parameter appNames Comma-separated list of app names to save .Parameter appBasePath Base path where apps are stored #> function Save-AppsToAzureStorage { Param( [Parameter(Mandatory=$true)] $StorageConnectionString, [Parameter(Mandatory=$true)] [string] $containerName, [Parameter(Mandatory=$true)] $appNames, [Parameter(Mandatory=$true)] $appBasePath, [Parameter(Mandatory=$true)] [string] $destinationPath, [switch] $silent ) $tempFile = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::newguid().ToString()).zip" $appNames | splitToArray(',') | findAppByNameInFolder($appBasePath) | Compress-Archive -DestinationPath $tempFile Copy-FileToAzureStorage ` -storageConnectionString "$StorageConnectionString" ` -containerName $containerName ` -filename $tempFile ` -destinationPath $destinationPath ` -silent:$silent Remove-Item $tempFile -Force -ErrorAction SilentlyContinue } Write-Verbose "Function imported: Save-AppsToAzureStorage" |