3

I am using Azure Devops 2019 with private agent and artifacts to store nuget and symbols. I am trying to upload the symbols during the build in the publish symbols path step. It seems I need to specify the PAT for this step but I am not sure where to do that. Here is part of the log:

2019-04-08T09:19:30.2367074Z ##[debug]ARTIFACTSERVICES_SYMBOL_ACCOUNTNAME (empty)
2019-04-08T09:19:30.2426018Z ##[debug]ARTIFACTSERVICES_SYMBOL_PAT (empty)
2019-04-08T09:19:30.2481875Z ##[debug]ARTIFACTSERVICES_SYMBOL_USEAAD (empty)
2019-04-08T09:19:30.2501336Z ##[debug] Converted to bool: False
2019-04-08T09:19:30.2530355Z ##[debug]SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: 'https://myserver/tfs/DefaultCollection/'
2019-04-08T09:19:30.2744544Z ##[debug]GET https://myserver/tfs/DefaultCollection//_apis/servicedefinitions/locationservice2/951917ac-a960-4999-8464-e3f0aa25b381 with 0-byte payload
2019-04-08T09:19:30.3183328Z ##[debug]Leaving C:\a\_work\_tasks\PublishSymbols_0675668a-7bba-4ccb-901d-5ad6554ca653\2.0.14\PublishSymbols.ps1.
2019-04-08T09:19:30.3231719Z ##[debug]Caught exception from task script.
2019-04-08T09:19:30.3264469Z ##[debug]Error record:
2019-04-08T09:19:30.4254635Z ##[debug]Invoke-WebRequest : 
2019-04-08T09:19:30.4267174Z ##[debug]
2019-04-08T09:19:30.4280196Z ##[debug]
2019-04-08T09:19:30.4293547Z ##[debug]    
2019-04-08T09:19:30.4306435Z ##[debug]        TF400813: Resource not available for anonymous access. Client authentication required. - Azure DevOps Server
2019-04-08T09:19:30.4319898Z ##[debug]                        
2019-04-08T09:19:30.4795963Z ##[debug]                Error
2019-04-08T09:19:30.4809832Z ##[debug]                The page you are looking for is currently unavailable.
2019-04-08T09:19:30.4823907Z ##[debug]                
2019-04-08T09:19:30.4837843Z ##[debug]                TF400813: Resource not available for anonymous access. Client authentication required.

This is the build pipeline:

enter image description here

Any idea how to specify the PAT for this step?

doorman
  • 15,707
  • 22
  • 80
  • 145

1 Answers1

1

401 unauthorized during the publish symbols path build step

You can try to add a nuget service connections with PAT.

When you use the nuget push task, there is a option NuGet server, which you can select the feed you have created or add a new one:

enter image description here

You can use Manage or New option to add a new nuget server:

enter image description here

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • Hi @LeoLiu-MSFT thanks for your suggestion but unfortunately we are still getting the unauthorized exception during the build symbol step. – doorman Apr 17 '19 at 10:08
  • Hey @Leo you answered me on [azure-devops-nuget-feed-with-symbols](https://stackoverflow.com/questions/64693265/azure-devops-nuget-feed-with-symbols). I get the same issue like here. We use our Azure DevOps Server on premise and I set up the Publish Symbols task with `Symbolservertyp` = `Symbol Server in this organization/collection`. Error: `(401) Unauthorized`. Your mentioned `NuGet Server` option only displayed, when your feed is outside of the organisation, but we use the internal artifacts feed. What could we do in this case? – Mar Tin Nov 06 '20 at 07:46
  • @MarTin, Have you add a `NuGet authenticate` task to use a service connection to authenticate your private feed? – Leo Liu Nov 06 '20 at 07:51
  • Never heard about this task. Per default we have the `Nuget installer` task and the `NuGet` task it self. the NuGet task provide `restore`, `pack`, `push` and `custom`. How could we use `NuGet authenticate`? – Mar Tin Nov 06 '20 at 07:54
  • @MarTin, Check my answer in this post, https://stackoverflow.com/questions/64151482/how-to-cleanly-automate-authentication-for-azure-devops-feeds/64166859#64166859. Add it after nuget installer task. Hope this helps you, have a nice day! – Leo Liu Nov 06 '20 at 07:59
  • @LeoLiu-MSFT seems the task is not available on Azure DevOps Server 2019, see [NuGet Authenticate Not Found](https://developercommunity.visualstudio.com/content/problem/950388/nuget-authenticate-not-found.html) – Mar Tin Nov 06 '20 at 08:16
  • @MarTin, Ohhh, you are in Azure DevOps Server 2019, that be a question, you could use nuget custom task to push the package with PAT. – Leo Liu Nov 06 '20 at 08:49
  • @LeoLiu-MSFT the `nuget push` task pushing `nupkg` into our `artifacts` work well (also without Authentifikation). The error `(401) Unauthorized` occurs on `Publish Symbols` task to `Symbol Server in this organization/collection`. There is possible a way to edit the `NuGet.Config` file, but I don't know how. Something what is not clear is which feed the **Symbols** (`pdb`) get uploaded? If I edit the `NuGet.Config` I have to setup a specific feed, but we use more than one feed in our Collection. – Mar Tin Nov 06 '20 at 08:57
  • @MarTin, Please check this link: https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#packagesourcecredentials – Leo Liu Nov 06 '20 at 09:02
  • @LeoLiu-MSFT thanks, now I am sure that my `NuGet.Config` is correct. But could you also tell me in which feed or in which manner symbols get published? How to configure when you have multiple feeds? – Mar Tin Nov 06 '20 at 09:19
  • @MarTin, Sorry, would you mind open a new thread for this new issue? I am stuck in another thread and cannot help you find a detailed answer for the time being. – Leo Liu Nov 06 '20 at 09:21
  • @MarTin, I forgot an important message, which task you are using to publish the symbols package? Is `Index sources and publish symbols`? If not, please try to use this task and tell me the result. Thanks. – Leo Liu Nov 06 '20 at 09:55
  • @LeoLiu-MSFT I exactly use this task `Index sources and publish symbols`. All experience above come from this task. Also the `(401) Unauthorized` error. – Mar Tin Nov 06 '20 at 10:51