login

Logs in to the Azure Sphere Security Service. By default, all azsphere commands apply to the current user’s login identity and tenant. The login command lets you use a different identity.

When you use azsphere, the Azure Sphere Security Service verifies your identity by using Microsoft Azure Active Directory (AAD). AAD uses Single Sign-On (SSO, which typically defaults to an existing identity on your PC. If this identity is not valid for use with your Azure Sphere tenant, azsphere commands may fail.

Use login to sign in explicitly to Azure Sphere Security Services. Upon success, this identity is used for subsequent azsphere commands. In most cases, you should only have to sign in once.

Optional parameters

Parameter Type Description Supported version
--use-device-code String Provides an alternate login mechanism based on device code. If the CLI is unable to launch a browser, this will be used for authentication. See device code flow for details about this form of authentication. Azure Sphere CLI
-u, --newuser String Specifies the email of the user to register. Azure Sphere classic CLI
--usedevicecode String Provides an alternate login mechanism based on device code. See device code flow for details about this form of authentication. Azure Sphere classic CLI
Global parameters

The following global parameters are available for the Azure Sphere CLI:

Parameter Description
--debug Increases logging verbosity to show all debug logs. If you find a bug, provide output generated with the --debug flag on when submitting a bug report.
-h, --help Prints CLI reference information about commands and their arguments and lists available subgroups and commands.
--only-show-errors Shows only errors, suppressing warnings.
-o, --output Changes the output format. The available output formats are json, jsonc (colorized JSON), tsv (Tab-Separated Values), table (human-readable ASCII tables), and yaml. By default the CLI outputs table. To learn more about the available output formats, see Output format for Azure Sphere CLI commands.
--query Uses the JMESPath query language to filter the output returned from Azure Sphere Security Services. See JMESPath tutorial and Query Azure CLI command output for more information and examples.
--verbose Prints information about resources created in Azure Sphere during an operation and other useful information. Use --debug for full debug logs.

Note

If you are using Azure Sphere classic CLI, see Global parameters for more information on available options.

Example

azsphere login
 ---------------------
 Name
 =====================
 user@microsoft.com
 ---------------------

In response, you should see a dialog box that lists your credentials or 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.