Posted on Leave a comment

##[error]Error: An unexpected error occurred while trying to push the package with VstsNuGetPush.exe – You need to have ‘ReadPackages’

When you try to push a nuget package from a DevOps pipeline on Artifacts feed you may face the below error.

##[error]Error: An unexpected error occurred while trying to push the package with VstsNuGetPush.exe. Exit code(1) and error(Error:
Microsoft.VisualStudio.Services.Common.VssServiceException: User 'xxx' lacks permission to complete this action. You need to have 'ReadPackages'

This error could be resolved by editing the settings of the feed.

In more detail under permissions you can find which users or service account can perform actions based on their role.

By default I could locate the Project Collection Build Service (Organization) with the Contributor permissions but did not work. As a solution I removed that and added "Project Name" Build Service (Organization). This is the build service for the project on which I have created the pipeline specifically.