Thursday, September 5, 2024

Simplifying Azure Login on Ubuntu Using the Command Line (Bash / SSH)

Managing Azure from the command line can enhance your workflow, making it more efficient and flexible. For Ubuntu users, logging into Azure using the Azure CLI (Command-Line Interface) is both simple and powerful. This guide walks you through the steps in a straightforward manner.

Logging in to Azure

To get started, open your terminal and log in by running the following command:

az login

Authenticate Through the Browser

When you run the az login command, a browser window will either open automatically or provide a link and a code for you to use. You can then securely enter your Azure credentials. Once logged in, your terminal will show details about your Azure subscription.
 

Selecting Your Subscription

If you have multiple subscriptions tied to your Azure account, you'll be prompted to select which one you'd like to use during your session. This helps ensure you're working within the correct environment.

Verifying Your Azure Account

To ensure that you’ve logged in successfully and to see a list of your Azure subscriptions, you can run the following command:

az account list --output table

This will display your subscriptions in a clear, tabular format, confirming that you're logged in and ready to begin managing your resources on Azure.
 

Logging Out

Once you're done with your session, you can safely log out from Azure by running:

az logout

This ensures your session is closed and your credentials are no longer active on the command line.

No comments: