Misc/Get-Pfx.ps1

function Get-PfxFile {
    Param(
        [Parameter(Mandatory = $true)]
        $Publisher
    )

    switch ($Publisher.ToUpper()) {
        "DTX" {
            $PfxFile = Get-Secret -vaultName "NAV-X" -secretName "DtxCodeSignPfxFile"
        }
        "NAV-X" {
            $PfxFile = Get-Secret -vaultName "NAV-X" -secretName "CodeSignPfxFile"
        }
        "Clients First Business Solutions" {
            $PfxFile = Get-Secret -vaultName "NAV-X" -secretName "CfbsCodeSignPfxFile"
        }
        default {
            $PfxFile = ""
        }
    }

    $PfxFile
}

function Get-PfxPassword {
    Param(
        [Parameter(Mandatory = $true)]
        $Publisher
    )

    switch ($Publisher.ToUpper()) {
        "DTX" {
            $PfxPassword = Get-Secret -vaultName "NAV-X" -secretName "DtxCodeSignPfxPassword"
        }
        "NAV-X" {
            $PfxPassword = Get-Secret -vaultName "NAV-X" -secretName "CodeSignPfxPassword"
        }
        "Clients First Business Solutions" {
            $PfxPassword = Get-Secret -vaultName "NAV-X" -secretName "CfbsCodeSignPfxPassword"
        }
        default {
            $PfxPassword = ""
        }
    }

    (ConvertTo-SecureString $PfxPassword -AsPlainText -Force)
}