Atria.Test.Setup-Bootstrap.ps1
<#PSScriptInfo
.VERSION 1.0.1 .GUID 75f8d73c-1b1a-421e-a6af-947ea18af56b .AUTHOR Aaron Lister .COMPANYNAME Automate101 .COPYRIGHT Automate101 Ltd 2020 .TAGS .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES #> #requires -RunAsAdministrator <# .DESCRIPTION Install the Atria.Tools module and setup the Atria Feed Repository #> param( [Parameter(Mandatory,HelpMessage='Enter your Username or email address')] [string] $UserName, [Parameter(Mandatory,HelpMessage='Enter your Personal Access Token')] [string] $PersonalAccessToken ) $RepositoryName = 'Atria' $RepositoryLocation = 'https://pkgs.dev.azure.com/Automate101/_packaging/Atria-Internal/nuget/v2' $passwordSecureString = ConvertTo-SecureString -String $PersonalAccessToken -AsPlainText -force $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ($UserName, $passwordSecureString) if (([Net.ServicePointManager]::SecurityProtocol).ToString().split(',').Trim() -notContains 'Tls12') { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 } if (!(Get-PackageProvider | Where-Object {$_.Name -eq 'NuGet'})) { $null = Install-PackageProvider -Name Nuget -MinimumVersion 2.8.5.201 -Force -Confirm:$false } Write-Host 'Setup PSRepository' $repo = Get-PSRepository -Name $RepositoryName -ErrorAction SilentlyContinue if (!$repo) { Register-PSRepository -Name $RepositoryName -SourceLocation $RepositoryLocation -Credential $credential -InstallationPolicy Trusted } else { Set-PSRepository -Name $RepositoryName -SourceLocation $RepositoryLocation -Credential $credential -InstallationPolicy Trusted } #Install-Module -Name Atria.Install -Repository Atria -Credential $credential Install-Module -Name Atria.Tools -Repository $RepositoryName -Credential $credential -Force Install-Module -Name Atria.Platform -Repository $RepositoryName -Credential $credential -Force Get-Module Atria.Tools | Remove-Module -Confirm:$false -Force Import-Module -Name Atria.Tools -force Connect-AtriaFeed -UserName $UserName -PersonalAccessToken $PersonalAccessToken -FeedUrl $RepositoryLocation Unregister-PSRepository -Name Atria |