src/Install-CciPlatformModules.ps1
function Install-cciPlatformModules { [CmdletBinding()] param ( $subscriptionName="CCI Platform", $keyvaultName="CCI-Platform-KV", $secretName="PAT-clemenscomer-cciplatform-2019", $patusername="clemenscomer", $ModuleName, $Scope = 'CurrentUser' ) begin { Write-Verbose "Started running $($MyInvocation.MyCommand)" } process { if ($null -eq (Get-PSRepository -Name cciplatform -ErrorAction SilentlyContinue)) { Register-cciPlatformRepo } if ($null -eq $script:vstsCred) { $getCciVstsCredentialParameters = @{ SubscriptionName = $subscriptionName KeyVaultName = $keyvaultName SecretName = $secretName PatUserName = $patusername } $script:vstsCred = Get-cciVstsCredential @getCciVstsCredentialParameters } if ($null -eq $ModuleName) { Install-Module -Repository CCIPlatform -Credential $script:vstsCred -Scope $Scope } else { Install-Module -Repository CCIPlatform -Credential $script:vstsCred -Scope $Scope -Name $ModuleName } } end { Write-Verbose "Finished running $($MyInvocation.MyCommand)" } } |