Authenticated Sources

Credentials

Authentication is natively handled in cChoco with a PSCredential object. Generating a public/private key pair with the .Net RNGCryptoServiceProvider Class allows you to build a secure portable credential that we can convert to a native PSCredential object at runtime.

New-EncryptedCredential

This function is included to help generate an encrypted public private key pair.

New-EncryptedCredential -Path C:\Temp\ -Password 'PlainTestPasswordString'
@{
    "contoso"    = @{
        Name     = "contoso.com"
        Priority = 1
        Source   = "https://contoso.com/repository/nuget-hosted/"
        Ensure   = "Present"
        User     = 'svc_nuget'
        Password = '76492d1116743f0423413b16050a5345MgB8ADkAdwBKAHkASgA5AFAAOAB1AEIAZAB5AEkAeAAwAEQAegBaAFgASQAxAFEAPQA9AHwAOQA0ADkANwBlADUAOABkADIAZQBlAGMANgA4AGMAZQBjAGEAMwA3AGIANgA3ADAAMgA0ADAAMgAzADcAMQA1AA=='
        KeyFile  = 'C:\ProgramData\cChocoEx\config\sources.key'
    }
}

Last updated

Was this helpful?