Storage/Save-AppsToAzureStorage.ps1
<#
$appNames = 'SMART Core,SMART Helpers' $appBasePath = "C:\Temp\Apps 1.3.26600" $tempFile = &tempFileName $appNames | splitToArray | findAppByNameInFolder($appBasePath) | Compress-Archive -DestinationPath $tempFile #> <# .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 permission Specifies the public level access to the container (if it gets created by this function) Default is Container, which provides full access. Other values are Blob or Off. .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=$false)] [ValidateSet('Container','Blob','Off')] [string] $permission = "Blob", [Parameter(Mandatory=$true)] $appNames, [Parameter(Mandatory=$true)] $appBasePath, [Parameter(Mandatory=$true)] [string] $destinationPath ) $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 Remove-Item $tempFile -Force -ErrorAction SilentlyContinue } Write-Verbose "Function imported: Save-AppsToAzureStorage" |