在CloudShell中使用MSAL

问题描述

我已经使用桌面PowerShell 5.1和7.0应用程序验证了MSAL身份验证路径。但是,所有在桌面上可用的身份验证路径都无法在CloudShell中使用-

PS /home/michael/CSTest/0.0.2/MicrosoftTeams> connect-microsoftteams
Connect-MicrosoftTeams: One or more errors occurred. (Unable to open a web page using xdg-open. See inner exception for details. Possible causes for this error are: xdg-open is not installed or it cannot find a way to open an url - make sure you can open a web page by invoking from a terminal: xdg-open https://www.bing.com )
Connect-MicrosoftTeams: Unable to open a web page using xdg-open. See inner exception for details. Possible causes for this error are: xdg-open is not installed or it cannot find a way to open an url - make sure you can open a web page by invoking from a terminal: xdg-open https://www.bing.com
Connect-MicrosoftTeams: No such file or directory
Connect-MicrosoftTeams: One or more errors occurred. (Unable to open a web page using xdg-open. See inner exception for details. Possible causes for this error are: xdg-open is not installed or it cannot find a way to open an url - make sure you can open a web page by invoking from a terminal: xdg-open https://www.bing.com )
PS /home/michael/CSTest/0.0.2/MicrosoftTeams> connect-microsoftteams -UseDeviceAuthentication
To sign in,use a web browser to open the page https://microsoft.com/devicelogin and enter the code BRZPG2UNE to authenticate.
Connect-MicrosoftTeams: One or more errors occurred. (Windows Data Protection API (DPAPI) is not supported on this platform.)
Connect-MicrosoftTeams: Windows Data Protection API (DPAPI) is not supported on this platform.
Connect-MicrosoftTeams: One or more errors occurred. (Windows Data Protection API (DPAPI) is not supported on this platform.)
PS /home/michael/CSTest/0.0.2/MicrosoftTeams> connect-microsoftteams -AccountId miluong@microsoft.com
Connect-MicrosoftTeams: One or more errors occurred. (Federated service at https://msft.sts.microsoft.com/adfs/services/trust/13/windowstransport returned error: )
Connect-MicrosoftTeams: Federated service at https://msft.sts.microsoft.com/adfs/services/trust/13/windowstransport returned error:
Connect-MicrosoftTeams: Federated service at https://msft.sts.microsoft.com/adfs/services/trust/13/windowstransport returned error:
Connect-MicrosoftTeams: One or more errors occurred. (Federated service at https://msft.sts.microsoft.com/adfs/services/trust/13/windowstransport returned error: )
  • 如何启用对托管身份的支持
  • 如何在没有xdg-open的情况下使交互式身份验证流程正常工作?目前,CloudShell尚未安装xdg-open
  • 是否有推荐的路径尝试在没有DPAPI的情况下获取令牌? CloudShell在Linux环境中工作,而DPAPI仅支持Windows。
  • 您是否知道在CloudShell中使用过任何使用MSAL的PS模块?

解决方法

  1. xdg-open不起作用,并且不计划在CloudShell中支持
  2. DPAPI错误是因为我试图通过静态加密来保护令牌
  3. CloudShell不支持集成Windows身份验证,因为它是基于Linux的环境。