AL/Get-CredentialFromEnvironmentJson.ps1

<#
 .Synopsis
  Gets the credential from settings.json
 .Description
  Gets credentials from settings.json
 .Parameter SourcePath
  Path to the current project
 .Example
  $secureCred = Get-CredentialFromEnvironmentJson
#>

function Get-CredentialFromEnvironmentJson {
    return New-Object System.Management.Automation.PSCredential((Get-Secret -vaultName "NAV-X" -secretName "Username"), (ConvertTo-SecureString (Get-Secret -vaultName "NAV-X" -secretName "Password") -AsPlainText -Force))
}