src/Get-CciVstsCredential.ps1
function Get-CciVstsCredential { [CmdletBinding()] param ( $subscriptionName, $keyvaultName, $secretName, $patusername ) begin { } process { $null = Connect-AzAccount -SubscriptionName $subscriptionName -Credential (Get-Credential) $secretValue = (Get-AzKeyVaultSecret -VaultName $keyvaultName -Name $secretName).SecretValueText $pat = ConvertTo-SecureString $secretValue -AsPlainText -Force New-Object PSCredential -ArgumentList $patusername, $pat } end { } } |