The Azure CLI is a set of open-source, cross-platform commands for working with the Azure platform. This article describes how to connect to your Azure subscription from the Azure CLI to use all of the CLI commands. If you haven't already installed the CLI, see Install the Azure CLI.
Use the azure login
command -- without any arguments -- to authenticate interactively with either:
- a work or school account identity that requires multi-factor authentication, or
- a Microsoft account identity when you want to access Resource Manager deployment mode functionality
Interactively logging in is easy: type azure login
and follow the prompts as shown below:
azure login
info: Executing command login
info: To sign in, use a web browser to open the page http://aka.ms/devicelogin. Enter the code XXXXXXXXX to authenticate. If you're signing in as an Azure AD application, use the --username and --password parameters.
Copy the code offered to you, above, and open a browser to http://aka.ms/devicelogin. Enter the code, and then you are prompted to enter the username and password for the identity you want to use. When that process completes, the command shell completes the log in process. It might look something like:
info: Added subscription Visual Studio Ultimate with MSDN
info: Added subscription Azure Free Trial
info: Setting subscription "Visual Studio Ultimate with MSDN" as default
+
info: login command OK