When working with NuGet repositories in Artifactory and the global anonymous access is enabled, we have two ways to work with the repositories:
1. Anonymous user have read permission for the repository:
In this case, we don't need to configure anything in the client side, since the anonymous user have read permissions and by default Artifactory allows anonymous access to NuGet repositories – this mean that every user can download any artifact from the repository.
2. Anonymous user does not have read permission for the repository:
In this case, we need to configure Artifactory so it will challenge the NuGet client and ask for credentials.
In order to configure Artifactory to challenge the NuGet client so it will send the provide with the user credentials, we need to enable the "Force Authentication" option in the repository configuration, by enabling the "Force Authentication" option Artifactory will first response with 401 response and let the client know that it waiting for the credentials:
I've enabled the "Force Authentication" option and now the client asked for credentials with every NuGet command, how can I solve this?
We can easily solve this behavior by adding the user credentials to the NuGet client configuration file, in order to add the credentials, please execute the following command:
#nuget sources update -Name <source name> -UserName <user name> -Password <password> , for example:
#nuget sources update -Name Artifactory -UserName admin -Password password