AWS Systems Manager not getting Credentials from Profile

Shane M 0 Reputation points
2023-12-01T21:57:22.4266667+00:00

Hello!

I have two local projects that are setup similarly. Except the one that works is in .NET 7.0 and the new one that doesn't work is 8.0.

 

I'm trying to setup the ability for my local dev environment to grab parameters from the AWS Parameter Store. 

Normally in the Program.cs file this is how it would look

// the profile is grabbed from the appsettings.Development.json and which is the same 
// value as setting up the profile using the command 'aws configure --profile <profile name>'

var profile = builder.Configuration.GetSection("AWS").GetSection("Profile").Value;

builder.Configuration.AddSystemsManager(options =>
{
    options.Path = "/AppName/EnvironmentName";
    options.ReloadAfter = TimeSpan.FromMinutes(30);
    options.AwsOptions = new AWSOptions
    {
        Profile = profile,
        Region = RegionEndpoint.CACentral1,
    };
});

This should be enough for the local environment to grab the aws credentials from the .aws/credentials file and use those credentials. I should be able to access my parameters from the parameter store.

However this for some reason doesn't work in my project that's in version 8.0. I double checked everything:

  • Using docker-compose I confirmed the .aws/credential file is being grabbed and transferred to the container as it is on my 7.0 project.
  • I verified the user with those credentials have full access permissions
  • double checked the values of the access/secret access keys are correct. Even created new ones just in case
  • verified the AWS Explorer in Visual Studio 2022 is on the correct profile

Everything is virtually setup the same on my 8.0 project that it is on my 7.0 project (the one that works).

In order for the 8.0 project to work, i have to hard code the credentials into the AWSOptions class like so:

    var credentials = new BasicAWSCredentials("<access key>", "<secret key>");
	options.AwsOptions = new AWSOptions
	{        
		Profile = profile,        
		Region = RegionEndpoint.CACentral1,    
		Credentials = credentials
	};

Which is not ideal.

The only conclusion I can come up with is something changed in the .NET 8.0 version that's not allowing it to grab my credentials.

Please let me know if there's something I'm missing or what troubleshooting steps I can take.

Thank you

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,742 questions
{count} votes

2 answers

Sort by: Most helpful
  1. farukranabappy081 0 Reputation points
    2023-12-03T02:49:40.4266667+00:00

    free update support

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more