Skip to content
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

Unable to use SSO Profiles when running dotnet restore #356

Open
gwin003 opened this issue Aug 16, 2023 · 4 comments
Open

Unable to use SSO Profiles when running dotnet restore #356

gwin003 opened this issue Aug 16, 2023 · 4 comments

Comments

@gwin003
Copy link

gwin003 commented Aug 16, 2023

We are migrating from local AWS profiles using access keys and secret keys to IAM Identity Center credentials using SSO. We have our credentials file working, and running commands like aws s3api list-buckets --query "Buckets[].Name" --profile profile1 are working correctly.

But I am unable to install nuget packages from CodeArtifact using the SSO profiles. Typically we would run dotnet restore --no-cache to update our packages, but running this now results in the following error.

error NU1301: Unable to load the service index for source https://{account}.d.codeartifact.us-east-1. amazonaws.com/nuget/{accountName}/v3/index.json.

#200 mentions that SSO profiles are supported, so I'm sure I'm using it wrong. Can anyone point me in the correct direction? TIA

@awschristou
Copy link
Contributor

Hi @gwin003 , this repo is related to the AWS Toolkit, which has a CodeArtifact handler. If you have the AWS Toolkit installed, and have configured the CodeArtifact profile to use, are you able to restore and build your projects from Visual Studio? This should prompt you to perform the SSO login flow.

To get things working from the command line, you will want to check out https://docs.aws.amazon.com/codeartifact/latest/ug/nuget-cli.html

@gwin003
Copy link
Author

gwin003 commented Aug 16, 2023

Hey @awschristou, sorry about that. Been bouncing around quite a few github repos today. Is there a better place to post this question?

Anyways I've been living on that page you linked without any success. Here's the steps I took...

dotnet tool uninstall -g AWS.CodeArtifact.NuGet.CredentialProvider
dotnet tool install -g AWS.CodeArtifact.NuGet.CredentialProvider`
dotnet codeartifact-creds install
aws sso login
aws s3api list-buckets --query "Buckets[].Name" --profile profile1  #this works
aws s3api list-buckets --query "Buckets[].Name" --profile profile2  #this also works
dotnet restore --no-cache                                           #this throws the above error

I do have the toolkit installed, but I typically use VS Code. I launched Visual Studio and attempted to use the toolkit but it keeps asking for Proxy Authentication to a single AWS Account (not the SSO provider).

@awschristou
Copy link
Contributor

awschristou commented Aug 16, 2023

@detam-amazon can you advise on a suitable repo for getting help with the CodeArtifact Credential provider?

@floralph floralph added the needs-response Waiting on additional info and feedback. Will move to `closing-soon` in 30 days label Aug 29, 2023
@mora260
Copy link

mora260 commented Sep 13, 2023

I'm experiencing the same issue. Even when configuring the SSO as the default AWS profile, always get the same error.

Did you get it to work @gwin003 ?

@github-actions github-actions bot removed the needs-response Waiting on additional info and feedback. Will move to `closing-soon` in 30 days label Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants