login (classic CLI)

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 uses Microsoft Azure Active Directory (AAD) to verify your identity. 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. For more information, see Connect a Microsoft account.

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
-u, --newuser String Specifies the email of the user to register.
--usedevicecode String Provides an alternate login mechanism based on device code. See device code flow for details about this form of authentication.
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
Login successful as 'bob@contoso.com'.
Selected Azure Sphere tenant is 'MyTenant' (143adbc9-1bf0-4be2-84a2-084a331d81cb).

Note

The Azure Sphere classic CLI is retiring. We recommend using Azure Sphere (Integrated).

In response, you should see a dialog box 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.