Public/Read-Config.ps1

<#
    .SYNOPSIS
    Read the org configuration from the user

    .DESCRIPTION
    This will prompt the user for the salesforce/hsdp configuration required and return an object with that information.

    .INPUTS
    None. You cannot pipe objects to Read-Config.

    .OUTPUTS
    The new PSCustomObject configuration object.

    .EXAMPLE
    PS> Read-Config
#>

function Read-Config {

    [CmdletBinding()]
    [OutputType([PSCustomObject])]
    param()

    begin {
        Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
    }

    end {
        Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete"
    }

    process {
        Write-Debug "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)"
        Write-Host "===== SFDC Username and Password"
        $SfCredentials = Get-Credential

        $SfSecurityToken = Read-Host -Prompt "SFDC Security Token"

        Write-Host "===== SFDC Oauth Consumer Key and Secret"
        $SfOauth = Get-Credential

        Write-Host "===== IAM Username and Password"
        $IamCredentials = Get-Credential

        $Sandbox = $false
        if ((Read-Host -Prompt "Sandbox? (Y/N)") -eq "Y") {
            $Sandbox = $true
        }

        Write-Output @{
            SfCredentials   = $SfCredentials
            SfSecurityToken = $SfSecurityToken
            SfOauth         = $SfOauth
            IamCredentials  = $IamCredentials
            Sandbox         = $Sandbox
            Scopes          = @("profile", "email", "read_write")
        }
    }
}