Kopīgot, izmantojot


Log in with Azure Sphere CLI

Important

This is the Azure Sphere (Legacy) documentation. Azure Sphere (Legacy) is retiring on 27 September 2027, and users must migrate to Azure Sphere (Integrated) by this time. Use the Version selector located above the TOC to view the Azure Sphere (Integrated) documentation.

Azure Sphere CLI provides two authentication types to log into the Azure Sphere Security Service. The easiest way to get started is using the Azure Sphere CLI, which automatically logs you in using the browser. If the CLI is unable to launch a browser, you can use the device code for authentication.

Log in interactively

The default authentication method in the Azure Sphere CLI uses the default web browser to sign in.

To log in, run the azsphere login command. For example:

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

The default web browser is opened and loads an Azure Sphere sign-in page that prompts you to log in. If the list includes the identity that you use for Azure Sphere, choose that identity. If not, enter the appropriate credentials.

Log in using the device code

If the CLI is unable to open the default web browser, or if the default web browser is unavailable, you can use the device code to log in using the command azsphere login --use-device-code.

  1. Open the browser at https://aka.ms/devicelogin and enter the authorization code displayed in your terminal.
  2. Sign in with your account credentials in the browser.

For example:

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
 ---------------------