简体   繁体   English

在 Visual Studio 代码中使用 SSO 配置文件调用 AWS cmdlet 时无法进行身份验证

[英]Unable to authenticate when invoking AWS cmdlets with SSO profile in visual studio code

I'm using visual studio code with the AWS cli version 2.9.13, I've got an SSO profile configured which I use to authenticate to the AWS service using device code authentication - I can then use this profile to connect to our AWS code commit repository however when trying to invoke any of the AWS PowerShell cmdlets I'm getting the below error returned;我在 AWS cli 版本 2.9.13 中使用 visual studio 代码,我配置了一个 SSO 配置文件,我用它来使用设备代码身份验证对 AWS 服务进行身份验证 - 然后我可以使用这个配置文件连接到我们的 AWS 代码提交存储库但是当尝试调用任何 AWS PowerShell cmdlet 时,我收到以下错误返回;

 Assembly AWSSDK.SSOOIDC could not be found or loaded. This assembly must be available at runtime to use Amazon.Runtime.Internal.SSOServiceClientHelpers, AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604.

This error is returned each time I use the profile parameter as shown below每次使用配置文件参数时都会返回此错误,如下所示

-ProfileName MySSOProfile

What i've done so far;到目前为止我做了什么;

  • Re installed the AWS modules i'm trying to use and installed the latest version重新安装了我尝试使用的 AWS 模块并安装了最新版本
  • Updated all packages on my WSL to the latest versions将我的 WSL 上的所有包更新到最新版本
  • Installed the AWS Toolkit extension for visual studio, now on version 1.60.0为 visual studio 安装了 AWS Toolkit 扩展,现在版本为 1.60.0
  • Installed AWSSDK.Core --version 3.7.103.13安装 AWSSDK.Core --version 3.7.103.13

What do I need to do to resolve this error and so that I can use my authenticated AWS profile to invoke the AWS cmdlets?我需要做什么才能解决此错误,以便我可以使用经过身份验证的 AWS 配置文件来调用 AWS cmdlet?

Using SSO credentials from either the .NET SDK or AWS Tools for PowerShell requires a dependency on the SDK's own SSO and SSOOIDC mdoules.使用来自 .NET SDK 或 PowerShell 的 AWS 工具的 SSO 凭证需要依赖于 SDK 自己的 SSO 和 SSOIDC mdoules。

Install-Module AWS.Tools.Installer
Install-AWSToolsModule S3, SSO, SSOOIDC

# Since we're not invoking a cmdlet from these modules directly, 
# we must import them explicitly
Import-Module AWS.Tools.SSO
Import-Module AWS.Tools.SSOOIDC

# AWS Tools for PowerShell doesn't support the SSO login flow yet, so login with the CLI
aws sso login --profile MySSOProfile

# Now we can invoke cmdlets using the SSO profile
Get-S3Bucket -ProfileName MySSOProfile

See also Update AWS CLI credentials from AWS IAM Identity Center by using PowerShell另请参阅使用 PowerShell 从 AWS IAM Identity Center 更新 AWS CLI 凭证

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS Java SDK 使用 AWS SSO 时找不到配置文件 - AWS Java SDK not finding profile when using AWS SSO AWS Toolkit Visual Studio Code Mac 无法找到凭证 - AWS Toolkit Visual Studio Code Mac Unable to locate credentials 无法打开 AWS Sagemaker Studio - Unable to open AWS Sagemaker Studio AWS Cognito 与 AWS SSO - AWS Cognito with AWS SSO 当从 visual studio 2019 推送 docker 图像时,服务任务在 aws ecs fargate 中停留在待定状态 - service task stuck at pending status in aws ecs fargate when pushing docker image from visual studio 2019 安装 AWS Toolking For Visual Studio 2017 for MAC - Install AWS Toolking For Visual Studio 2017 for MAC Terraform AWS:“ssh:无法验证,尝试的方法 [无公钥]” - Terraform AWS: "ssh: unable to authenticate, attempted methods [none publickey]" 使用实例配置文件时如何在 AWS CLI 中设置配置文件名称 - How to set profile name in AWS CLI when using instance profile 在 AWS 上调用 lambda function 时出现 DllNotFoundException libgurobi95 - DllNotFoundException libgurobi95 when invoking lambda function on AWS AWS CodeBuild Visual Studio 2019 构建工具 - AWS CodeBuild Visual Studio 2019 build tools
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM