-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot update workload manifests from authenticated AzDO feeds on macOS #35912
Comments
Chet believes the code in question might be here but it is correctly passing the interactive flag through: sdk/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandNuGetRestoreActionConfigOptions.cs Lines 55 to 58 in 6483a69
|
I didn't have this issue on Ubuntu FWIW, and others have hit this on macOS too, but I appreciate it might be hard to repro without a workload manifest update ready to go on a private feed. |
@DamianEdwards did you tried |
Thanks a bunch to @rmarinho and @mattleibow for helping investigate this. The problem is caused by running under su/sudo. When running a workload command under sudo, we override the This means that when run under sudo, the credential provider isn't found by NuGet (since the path to search for it is in the HOME directory). This is also probably why putting the PATs in the NuGet.config file didn't work. (We do try to copy the NuGet.config to the new temporary home directory, but maybe this is failing). We will discuss to see what we can do to improve this. For now, putting PATs in a NuGet.config file and specifying that file via the |
That will explain why it always runs the first-run experience too I guess. I'm still unable to get it to work with the |
That said, I'd expect an authorization failure to be logged exactly as that, but what I'm seeing is "NotFound" results. I'll share the repo details and logs internally to see if that can aid in diagnosing what's going on. |
The output is pretty verbose, and it's checking for packages on all the different feeds that are set up. So you get a lot of NotFound log messages before you get the message related to the authorization failure, which looks something like:
We might be able to detect the authorization error specifically and generate a more specific error message. It might also be a good idea to generate a warning if |
Any idea why I'm unable to make it work with a PAT and the |
Not really. Are you sure the syntax in the config file for the PAT is correct? |
Not sure. I'm just working from documentation. The fact it's trying the right feed suggests it is picking up the nuget.config, and there are no parsing errors. I'm not sure what else to try. |
BTW I think I'm hitting the same issue on Windows (@DamianEdwards had it on macOS). I have Azure Cred Provider, but it doesn't seem to get used when I restore workloads. If I pass in |
We are discussing making --interactive default in some situations but the behavior you report is expected. Having the cred provider installed today is not sufficient to trigger the device login details as interactive is needed as well. |
@DamianEdwards per this doc the nuget plugin discovery is extensible via environment variables. Can you try:
|
Another thing to try - the azure feed provider puts session tokens in a directory that's configurable via env var, and NuGet will also look in this location. Consider setting the location per these docs to somewhere outside of $HOME and trying that as well. |
cc @kartheekp-ms for visibility per Jon's suggestion |
As pointed out in #35912 (comment), the following environment variable might be helpful to work around this issue:
I guess we don't have to set In case it helps, this document contains environment variables that can be set to manage NuGet global packages and cache folders. |
I started encountering a MAUI iOS build issue that only seems to occur on Azure Pipelines. After investigating, I found that we were encountering this authentication error at the We don't actually load workloads from authenticated sources, so I'll try passing a EDIT: Yep, that was the problem and the solution worked. Here's the PowerShell step I used in my pipeline: $NuGetConfig = Join-Path $env:AGENT_TEMPDIRECTORY "NuGet.Config"
Write-Host "Writing temporary NuGet.Config to $NuGetConfig..."
New-Item $NuGetConfig
Set-Content $NuGetConfig '<configuration><packageSources><add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /></packageSources></configuration>'
dotnet workload install maui --configfile $NuGetConfig
dotnet workload list After applying the above workaround, the newest version of the workload was successfully installed. |
Hi, I have same problem, cannot install workload to my macbook for sudo needed ones. Getting error= Failed to update the advertising manifest microsoft.net.sdk.android: Unable to load the service index for source https://api.nuget.org/v3/index.json.. I tried adding a nuget.config myself and use --configfile, but it did not work % dotnet --info Runtime Environment: .NET workloads installed: Host: .NET SDKs installed: .NET runtimes installed: Other architectures found: Environment variables: global.json file: Learn more: Download .NET: |
Tried the hack with setting |
Yeah this seems to only work for me if using the --configFile, sudo commands will not work without that . |
Even when I add the configfile option, it still wants me to run in |
I'm not able to get any
dotnet workload
related commands to work when one of the workload manifests has updates on an authenticated AzDO artifacts feed on macOS. I've installed the nuget credential provider anddotnet restore
from that feed works just fine.I've tried relying on on-demand token acquisition (via device flow and passing
--interactive
), configuring a PAT in theNuGet.config
file, passing the source directly, etc. Every time,sudo dotnet workload update
fails with the following error message:Output of
dotnet --info
:The text was updated successfully, but these errors were encountered: