Module/HelperFunctions/ModuleProfileHelper.ps1

function CreateProfileConfig {
    [string] $userProfilePath,
    [string] $azureUserName,
    [SecureString] $azurePassword

    if (Test-Path $userProfilePath) {
        Remove-Item $userProfilePath
    }

    New-Item -path $userProfilePath -ItemType File -Force

    $azurePasswordPlainText = $azurePassword | ConvertFrom-SecureString

    $userProfileJson = @"
{
  "AzureUserName": "$($azureUserName)",
  "AzurePassword": "$($azurePasswordPlainText)"
}
"@


    $userProfileJson | Format-Json -Indentation 2 | out-file $userProfilePath
}

function LoadProfileConfig {
    [string] $userProfilePath

    Get-Content $userProfilePath -Raw | ConvertFrom-Json
}