src/Find-CciPlatformModules.ps1
function Find-CciPlatformModules { [CmdletBinding()] param ( $subscriptionName="CCI Platform", $keyvaultName="CCI-Platform-KV", $secretName="PAT-clemenscomer-cciplatform-2019", $patusername="clemenscomer", $ModuleName ) 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) { Find-Module -Repository CCIPlatform -Credential $script:vstsCred } else { Find-Module -Repository CCIPlatform -Credential $script:vstsCred -Name $ModuleName } } end { Write-Verbose "Finished running $($MyInvocation.MyCommand)" } } |