When the Azure Sphere SDK is installed on Windows 10, it sets up an "Azure Sphere Developer Command Prompt" that can be run to use the Azure Sphere Utility ( azsphere ) tooling. It’s great to be able to use the Azure Sphere command-line tools, but it would be even greater to have access to this within the Windows Terminal. Follow the below instructions to setup a custom Windows Terminal profile for the Azure Sphere Developer Command Prompt to run alongside all your other custom Windows Terminal tabs!





Starting the Azure Sphere Developer Command Prompt The Azure Sphere SDK is installed to the C:\Program Files (x86)\Microsoft Azure Sphere SDK directory on Windows 10. When you run the Azure Sphere Developer Command Prompt from the Start Menu, it opens a new Command Prompt window by running the InitializeCommandPrompt.cmd script in that folder. You can run the InitializeCommandPrompt.cmd script too, by executing the following at any Command Prompt: cmd.exe /k "C:\Program Files (x86)\Microsoft Azure Sphere SDK\InitializeCommandPrompt.cmd" The next step to getting Windows Terminal integration, it to setup a custom Windows Terminal profile that starts up a new terminal instance by running this same Azure Sphere command.

Create a Windows Terminal Profile for Azure Sphere The Windows Terminal makes it really easy to customize the settings and create your own custom Windows Terminal Profiles. Editing a single JSON file named profiles.json is all it takes. Follow these steps to create a custom Azure Sphere Developer profile within the Windows Terminal: Open the Windows Terminal, click on the down arrow button at the top of the window. Select the Settings option. This will open up the profiles.json file for editing. This file can be edited using VSCode, Notepad, or any other text editor. Once editing the profiles.json file, locate the profile array in the JSON file. This element contains the configurations for the various Windows Terminal Profiles you have configured. Within the list of profiles in the JSON, paste in the following block of JSON to create a Azure Sphere Developer profile. { "guid": "{0eaf3575-0724-4192-8e31-f8550890c7d5}", "name": "Azure Sphere Developer", "commandline": "cmd.exe /k \"C:\\Program Files (x86)\\Microsoft Azure Sphere SDK\\InitializeCommandPrompt.cmd\"", "hidden": false, "icon": "C:\\Program Files (x86)\\Microsoft Azure Sphere SDK\\Azure Sphere.png", "backgroundImage": "C:\\Program Files (x86)\\Microsoft Azure Sphere SDK\\Azure Sphere.png", "backgroundImageOpacity": 0.1, "startingDirectory": "%USERPROFILE%" } Save the profiles.json file.

Add the Azure Sphere Icon to the Windows Terminal Profile As you can see, in the JSON for the Azure Sphere Developer Windows Terminal Profile that was created above, there are icon and backgroundImage properties. The icon property tells Windows Terminal an image to use for the icon to display for the Azure Sphere Developer profile and on the tab for open instances of it. The backgroundImage property tells Windows Terminal an image to use for the background of the Windows Terminal tab for the profile. Since the Azure Sphere Developer Windows Terminal Profile JSON copied from above already contains these properties for the Azure Sphere Icon images, all you need to do is save the image file to your local machine with the name in the JSON.

Here’s an Azure Sphere Icon image file you can use: https://build5nines.com/wp-content/uploads/2019/11/Azure-Sphere.png

To add the Azure Sphere icon to the Azure Sphere Developer Windows Terminal Profile, just download the image at the above URL, and save it to C:\Program Files (x86)\Microsoft Azure Sphere SDK\Azure Sphere.png . This is the file location the Windows Terminal Profile JSON is already looking for. Keep in mind that since this Azure Sphere icon image file is being saved to the directory where the Azure Sphere SDK is installed, you may need to save the image there again when installing any updates to the Azure Sphere SDK at a later time.

Wrap Up Once you follow the simple steps above, you will have created a new profile in the Windows Terminal for the Azure Sphere Developer Command Prompt. This will allow you to use the Azure Sphere CLI alongside any other PowerShell and/or Command Prompts you may be using within the Windows Terminal.

Article Author

Chris Pietschmann Chris is the Founder of Build5Nines.com and a Microsoft MVP in Azure & IoT with 20 years of experience designing and building Cloud & Enterprise systems. He is also a Microsoft Certified: Azure Solutions Architect, developer, Microsoft Certified Trainer (MCT), and Cloud Advocate. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.