How to automate "TF get" permanently

201 views Asked by At

I have a batch job on a (windows 10) machine that runs every night. A part of the job is to do a "tf get /login:[PAT]". This works for a couple of days after which it fails with "you are not authorized to access". Basically what happens is, after some days the PAT alone doesn't work anymore and the "password prompt" window gets displayed. As nobody is monitoring this job, nobody enters anything and the window times out after some time and tf access is denied.

If, after the failure, i run this job manually and enter the correct credentials into the login window (and also authorize the access on my phone, because the underlying account is protected by 2fa), everything starts working again, for a couple of days.

What do i need to do in order to make this run w/o the need for a manual intervention?

1

There are 1 answers

2
Andy Li-MSFT On

I don't think we can make it automate permanently if you have set auth policies, generally it will ask to reauthenticate every few days based on your policy settings.

For the PAT, it also has an expiration, even though we can define the expiration date a bit longer (Can be set to a maximum of one year).