Ctrl+Shift+A in Windows Terminal to launch Azure CLI authentication

Ctrl+Shift+A in Windows Terminal to launch Azure CLI authentication

Configuring Actions in Windows Terminal

I found logging into Azure via CLI a repetitive task but not a long one. I did however utilised Windows Terminal Actions to create key bindings to type in the login command.

Configuring settings.json ✍️

  1. Launch Windows Terminal;
  2. Select the down arrow next to the add tab option and select Settings; azloginterm3.png
  3. The settings.json file will open up with your default code editor. Within the file you need to add the below line of code:
     "actions": [
         { "command": { "action": "sendInput", "input": "az login\return" }, "keys": "ctrl+shift+a" }
     ],
    
    Add this code in a place appropriate, it should look something like this: azloginterm1.png Once the code has been included in the file, save it and relaunch Windows Terminal (any errors, review and correct).

How to launch 🚀

Now your ready to sign in to Azure CLI using the key bindings, launch Windows Terminal and hold down the following keys: Ctrl + Shift + A

Once you do this, the below will display on your terminal: azloginterm2.png

You will also have a web browser window appear asking you to login to Azure to authenticate.

What else can you do 💭

You can amend the command line field so you can include some more information to include as part of the authentication. Find all sign in methods from Microsoft Azure CLI documentation. There is other ways to improve on this or to do something different but remember to consider security before implementing these, you do not want to reduce security to improve convenience.

Did you find this article valuable?

Support James Cook by becoming a sponsor. Any amount is appreciated!