Skip to content

Commit

Permalink
Merge pull request #19 from jheiselman/issue-18
Browse files Browse the repository at this point in the history
Allow Invoke-GetCCPCredential to pass any VaultParameters
  • Loading branch information
aaearon authored Apr 20, 2023
2 parents e301026 + 96d26d7 commit fdf13a8
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,19 @@ function Invoke-GetCCPCredential {
[hashtable] $AdditionalParameters
)

$VaultParameters = (Get-SecretVault -Name $VaultName).VaultParameters

$GetCCPCredentialParameters = @{
AppID = $VaultParameters.AppID
URL = $VaultParameters.URL
Object = $Name
if ($null -ne $VaultName) {
$VaultParameters = (Get-SecretVault -Name $VaultName).VaultParameters
}
else {
$VaultParameters = (Get-SecretVault).VaultParameters
}
if ($null -eq $VaultParameters) {
throw "No vault parameters!"
}
if ($VaultParameters.SkipCertificateCheck) { $GetCCPCredentialParameters.Add('SkipCertificateCheck', $VaultParameters.SkipCertificateCheck) }
if ($VaultParameters.UseDefaultCredentials) { $GetCCPCredentialParameters.Add('UseDefaultCredentials', $VaultParameters.UseDefaultCredentials) }
if ($VaultParameters.Credential) { $GetCCPCredentialParameters.Add('Credential', $VaultParameters.Credential) }
if ($VaultParameters.CertificateThumbPrint) { $GetCCPCredentialParameters.Add('CertificateThumbPrint', $VaultParameters.CertificateThumbPrint) }
if ($VaultParameters.Certificate) { $GetCCPCredentialParameters.Add('Certificate', $VaultParameters.Certificatel) }

$GetCCPCredentialParameters = [System.Collections.Hashtable]::new($VaultParameters)
$GetCCPCredentialParameters.Remove("ConnectionType")
$GetCCPCredentialParameters.Add("Object", $Name)

$Credential = Get-CCPCredential @GetCCPCredentialParameters
return $Credential
Expand Down

0 comments on commit fdf13a8

Please sign in to comment.