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
- Launch Windows Terminal;
- Select the down arrow next to the add tab option and select Settings;
- 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:
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:
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.
Top comments (0)