使用 Azure Sphere CLI 登录

Azure Sphere CLI 提供两种身份验证类型来登录到 Azure Sphere 安全服务。 最简单的入门方法是使用 Azure Sphere CLI,该 CLI 使用浏览器自动登录。 如果 CLI 无法启动浏览器,可以使用设备代码进行身份验证。

以交互方式登录

Azure Sphere CLI 中的默认身份验证方法使用默认 Web 浏览器登录。

若要登录,请运行 azsphere login 命令。 例如:

azsphere login
---------------------
Name
=====================
bob@contoso.com
---------------------

默认 Web 浏览器已打开,并加载提示登录的 Azure Sphere 登录页。 如果列表包含用于 Azure Sphere 的标识,请选择该标识。 如果没有,请输入相应的凭据。

使用设备代码登录

如果 CLI 无法打开默认 Web 浏览器,或者默认 Web 浏览器不可用,则可以使用设备代码通过 azsphere login --use-device-code 命令登录。

  1. https://aka.ms/devicelogin 处打开浏览器,并输入终端中显示的授权代码。
  2. 在浏览器中使用帐户凭据登录。

例如:

azsphere login --use-device-code
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <device-code> to authenticate.
 ---------------------
 Name
 =====================
 bob@contoso.com
 ---------------------