I really like the Windows Terminal – an awesome tool which I use daily. Some time ago, I posted my My Windows Terminal Config. These days, I added the Exchange Online Shell as another option in my config. Here is how you can add it.

Note: Exchange Online Shell does not work within powershell core, that’s why we use standard powershell.
Step 1: Install ExchangeOnlineManagement
Open Powershell (not core) as administrator and install the module “ExchangeOnlineManagement”:
Install-Module ExchangeOnlineManagement
Step 2: Verify if it works
Import-Module ExchangeOnlineManagement Connect-ExchangeOnline # sign in Get-MailUser
If Connect-ExchangeOnline throws:
Could not load type ‘System.Security.Cryptography.SHA256Cng’ from assembly ‘System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ …
switch to “classic” Powershell. This error occurs if you use Powershell Core. ExchangeOnlineManagement only works within Powershell.
Step 3: Add Exchange Online to Windows Terminal
Open settings of Windows Terminal and add:
{ "guid": "{2f59be3b-a8a2-4131-98c9-e8531cbc4dd9}", "name": "Exchange Online Shell", "commandline": "powershell.exe -NoExit -Command \"Import-Module ExchangeOnlineManagement; Connect-ExchangeOnline\"", "background": "#012456", "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png" }
If you always use the same user, you can add “-UserPrincipalName [email protected]” to the config:
{ "guid": "{2f59be3b-a8a2-4131-98c9-e8531cbc4dd9}", "name": "Exchange Online Shell", "commandline": "powershell.exe -NoExit -Command \"Import-Module ExchangeOnlineManagement; Connect-ExchangeOnline -UserPrincipalName [email protected]\"", "background": "#012456", "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png" }
My entire Windows Terminal config
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
// My personal settings - arminreiter.com | |
// list of all settings: https://github.com/microsoft/terminal/blob/master/doc/cascadia/SettingsSchema.md | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", | |
// "initialCols": 120, | |
// "initalRows": 30, | |
"theme": "dark", | |
"profiles": { | |
"defaults": { | |
"acrylicOpacity": 1.0, | |
"useAcrylic": false, | |
"fontSize": 10, | |
"fontFace": "Cascadia Code", | |
"startingDirectory": "c:\\", | |
"background": "#000000", | |
"backgroundImage": "c:\\data\\tmp\\WindowsTerminal\\LogoQuerWhite.png", | |
"backgroundImageOpacity": 0.8, | |
"backgroundImageStretchMode": "none", | |
"backgroundImageAlignment": "topRight", | |
"experimental.retroTerminalEffect": false | |
}, | |
"list": [ | |
{ | |
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", | |
"name": "PowerShell", | |
"source": "Windows.Terminal.PowershellCore" | |
}, | |
{ | |
// Make changes here to the powershell.exe profile | |
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", | |
"name": "Windows PowerShell", | |
"commandline": "powershell.exe" | |
}, | |
{ | |
// Make changes here to the cmd.exe profile | |
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", | |
"name": "cmd", | |
"commandline": "cmd.exe" | |
}, | |
{ | |
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", | |
"name": "Azure Cloud Shell", | |
"source": "Windows.Terminal.Azure" | |
}, | |
{ | |
"guid": "{2f59be3b-a8a2-4131-98c9-e8531cbc4dd9}", | |
"name": "Exchange Online Shell", | |
"commandline": "powershell.exe -NoExit -Command \"Import-Module ExchangeOnlineManagement; Connect-ExchangeOnline -UserPrincipalName [email protected]\"", | |
"background": "#012456", | |
"icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png" | |
}, | |
{ | |
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", | |
"name": "Ubuntu", | |
"source": "Windows.Terminal.Wsl" | |
}, | |
{ | |
"guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}", | |
"hidden": false, | |
"name": "kali-linux", | |
"source": "Windows.Terminal.Wsl" | |
} | |
] | |
}, | |
// Add custom color schemes to this array | |
"schemes": [], | |
// Add any keybinding overrides to this array. | |
// To unbind a default keybinding, set the command to "unbound" | |
"keybindings": [] | |
} |
7 Responses
How did you come up with the GUID for the profile?
I’ve read you need to use a UUID V5 generator, but I’ve not had any success.
I created one with powershell:
new-guid
Does that GUID not have any bearing on the name of the profile?
I was trying to come up with the Ubuntu GUID shown in the Microsoft document below by running it through various Version 5 UUID generators, but could never come up with the GUID shown.
https://docs.microsoft.com/en-us/windows/terminal/json-fragment-extensions
My understanding was that the GUID needed to be generated based on the profile name. But I could be completely misunderstanding all of this.
I generated a new one according to this post on github:
https://github.com/microsoft/terminal/issues/1735
and it worked fine. So never had an issue.
Thanks, I’ll give it a shot!
Awesome tip! I use the Exchange Online to manage delegated organizations using the
“-delegatedorganization contoso.onmicrosoft.com”
flag. I wonder if your command line could be modified to prompt for the domain name? I played around with it for a bit, but couldn’t get it to work.
what a great idea! I have multiple profiles for that, but you could also use the following:
"commandline": "powershell.exe -NoExit -Command \"Import-Module ExchangeOnlineManagement; $server = Read-Host -Prompt 'Input your server name'; Connect-ExchangeOnline -UserPrincipalName [email protected] -DelegatedOrganization $server.onmicrosoft.com\"",