Module/Misc/Get-BCSModuleProfile.ps1

<#
.SYNOPSIS
    Get your Module profile details
.DESCRIPTION
    Read confing.json in APPDATA\BCSPowershellModule and returns a json object
.EXAMPLE
    Get-BCSModuleProfile
.NOTES
    Author: Mathias Stjernfelt
    Website: http://www.brightcom.se
#>

function Get-BCSModuleProfile {
    begin {}

    process {
        $userProfilePath = "$env:LOCALAPPDATA\BCSPowershellModule\config.json"

        if (-not (Test-Path $userProfilePath)) {
            
            $azCred = Get-Credential -Message "Specify the Azure AD credentials to be stored in your BCS Module profile"
            $dbCred = Get-Credential -Message "Specify the SQL Database credentials to be stored in your BCS Module profile"

            New-BCSModuleProfile -azureUserName $azCred.UserName -azurePassword $azCred.Password -databaseUserName $dbCred.UserName -databasePassword $dbCred.Password
        }
        
        $userProfileJson = LoadProfileConfig -path $userProfilePath
        $userProfileJson
    }
    end {
    }
}

Export-ModuleMember -Function Get-BCSModuleProfile