src/Find-CciPlatformModules.ps1

function Find-CciPlatformModules {
    [CmdletBinding()]
    param (
        $subscriptionName="CCI Platform",
        $keyvaultName="CCI-Platform-KV",
        $secretName="PAT-clemenscomer-cciplatform-2018",
        $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) {
            $script:vstsCred = Get-CciVstsCredential @PSBoundParameters
        }
        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)"
    }
}