Granting Read Privileges to Azure Artifact Feed

David Maryo 101 Reputation points
2022-02-04T14:37:26.19+00:00

How to provide permissions to this USER to access the Packages from Azure Artifact Feed? We have tried checking on the backend to see what that UserID is referring to but unfortunately, I can't find any user with that User ID in our Azure Active Directory? Would like to get some expert advise on this.

{"message":"User '4a2eb786-540d-4690-a12b-4badf25ea6e0' lacks permission to complete this action. You need to have 'ReadPackages'.","typeName":"Microsoft.VisualStudio.Services.Feed.WebApi.FeedNeedsPermissionsException, Microsoft.VisualStudio.Services.Feed.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=
Microsoft Entra
{count} vote

2 answers

Sort by: Most helpful
  1. Arkadiusz Kozieł 41 Reputation points
    2022-08-01T18:57:07.377+00:00

    I had similar issue.
    I granted Contributor for 2 users:
    <YOUR PROJECT NAME> Build Service (<YOUR-ORG-NAME>)
    Project Collection Build Service (<YOUR-ORG-NAME>)

    I was also NOT able to findout what is the user name based on error:

    [warning]User 'd909a33e-1349-4057-99ea-5d1742b38c3a' lacks permission to complete this action. You need to have 'ReadPackages'.

    You can see this on attachement
    This solved my issue.
    226809-2022-08-01-20-49-51.jpg

    7 people found this answer helpful.

  2. Marilee Turscak-MSFT 33,801 Reputation points Microsoft Employee
    2022-02-07T18:16:35.57+00:00

    Hi @David Maryo ,

    I understand that you are trying to grant "Read" permissions to a particular user to allow that user to access the Azure Artifact Feed. I understand that you are also hoping to figure out how to locate the user by User ID.

    In order to grant Read permissions to Azure Artifacts for the user, you need to go to Artifacts > Permissions > Add users/groups > Add the user and select the Access role:

    171968-image.png

    To figure out which user has that particular Object ID, you can use the Get-AzureADObjectByObjectId Powershell command.

    Get-AzureADObjectByObjectId  
       -ObjectIds <System.Collections.Generic.List`1[System.String]>  
       [-Types <System.Collections.Generic.List`1[System.String]>]  
       [<CommonParameters>]  
    

    You can also use Microsoft Graph API:

    POST https://graph.microsoft.com/v1.0/directoryObjects/getByIds  
    Content-type: application/json  
      
    {  
        "ids":[""]  
    }  
    

    If you want to call the Microsoft Graph with Azure CLI, you can use the command az rest

    **az rest --method POST --url 'https://graph.microsoft.com/v1.0/directoryObjects/getByIds' --headers 'Content-Type=application/json'  --body '{"ids":[""]}'**  
    

    Let me know if this helps and if you have further questions.

    Thanks,

    Marilee