簡體   English   中英

在 Visual Studio 代碼中使用 SSO 配置文件調用 AWS cmdlet 時無法進行身份驗證

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

我在 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.

每次使用配置文件參數時都會返回此錯誤,如下所示

-ProfileName MySSOProfile

到目前為止我做了什么;

  • 重新安裝了我嘗試使用的 AWS 模塊並安裝了最新版本
  • 將我的 WSL 上的所有包更新到最新版本
  • 為 visual studio 安裝了 AWS Toolkit 擴展,現在版本為 1.60.0
  • 安裝 AWSSDK.Core --version 3.7.103.13

我需要做什么才能解決此錯誤,以便我可以使用經過身份驗證的 AWS 配置文件來調用 AWS cmdlet?

使用來自 .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

另請參閱使用 PowerShell 從 AWS IAM Identity Center 更新 AWS CLI 憑證

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM