I'm using Powershell DSC to set up a Windows Server 2012 R2 box. As part of the configuration process, I'm provisioning jfrog.exe and executing a configuration command as a service account:
jfrog rt config --url=$localArtifactoryInstance --user=$username --apikey=$apikey
This command creates .jfrog.jfrog-cli.conf in the service account's home directory (C:\Users\$serviceAccount.jfrog.jfrog-cli.conf) as expected, containing URL/username/apiKey.
Post-provisioning, this service account is charged with 'promoting' artifacts from one repository to another:
jfrog rt move '$devRepo/(Org)/(Org.Common.Configuration)/Org.Common.Configuration.1.0.0.nupkg' '$prodRepo/{1}/{2}/'
This command is rejected with a 401:
[Error] Artifactory response: 401 Unauthorized
{
"errors": [
{
"status": 401,
"message": "Bad authentication. Provided username or password are incorrect."
}
]
}
However, when I add the same API key as is already configured in jfrog-cli.conf to the command:
jfrog rt move '$devRepo/(Org)/(Org.Common.Configuration)/Org.Common.Configuration.1.0.0.nupkg' '$prodRepo/{1}/{2}/' --ApiKey $apiKey
It is successful, and I can verify success via the Artifactory UI.
- The service account executing the command is the same as the service account that executed jfrog rt config, and matches the username in jfrog-cli.conf.
- The API key was generated in Artifactory for that service account
- I have tried altering the username in jfrog-cli.conf to include and not include the domain
- I have ensured that the environment variable 'HOME' exists and is pointed to the service account's home directory (https://github.com/JFrogDev/jfrog-cli-go/blob/master/utils/ioutils/ioutils.go seems to imply that this variable is necessary)
- 'jfrog rt config show' shows the correct data
Thanks for any help or guidance you can supply!