Closed Ankita-Chaudhari closed 4 years ago
Hi! Thanks for the question! Currently the AccountCredentials
are expected to include a PAT as the password and the username is ignored so you should be able to do what you want right now. =)
FYI, we pass them as a Credential through DSC as DSC doesn't support SecureString
by itself. You can see here where the Password is used as a PAT for the call to Install-VSTSAgent
.
Good luck and let us know if you run into any issues!
I cannot see the example file in the link provided by you https://github.com/microsoft/VSTSAgent.PowerShell/issues/Install-VSTSAgent.
Thank you for the link!
This is my configuration file
Configuration xVSTSAgent_Install {
param
(
[parameter(Mandatory = $true)]
[PSCredential]$AccountCredential
)
Import-DscResource -ModuleName VSTSAgent
Node 'localhost' {
xVSTSAgent VSTSAgent {
Name = 'Agent01'
ServerUrl = 'https://XXXX.visualstudio.com'
AccountCredential = $AccountCredential
AgentDirectory = 'C:\Agent'
Work = 'C:\VSTSAgentsWork\Agent01'
Ensure = 'Present'
}
}
}
When I compile this configuration it asks for account creds, to that input I am passing the PAT token. It fails with the following error : "Credential with name 'PAT Token' not found for account '0d059b1b-0d4d-4e56-8b5a-dbc80da1a5cd'."
Could you please help me with an example file on how to pass the PAT token?
Thanks in advance!
In Azure Automation you have to create a Credential in the Automation account. Then you can pass the name of that credential to the compilation job - it'll replace it with the actual PSCredential behind the scenes for you.
Hi,
I need to install a VSTS agent inside an Azure VM using a DSC configuration file. As my client's requirement, they want to make use of PAT rather than passing the Account credentials. Is there any way by which I can use this module to install VSTS agent using PAT? If yes, could you please share with me an example of how to use it.
Thanks in advance.