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