Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

I have been playing around with my Linux environment and AzureRM.Netcore cmdlets for some time now. I have also been using my Windows 10 WSL (Windows Subsystem for Linux) for working cross-platform with Microsoft Azure Cloud Shell.

Azure Cloud Shell has been around for some time and has undergone some significant improvements—notably the ability to pick which command line to use right from the browser.

This image shows the Microsoft Azure Portal with the Azure Cloud Shell integrated into the browser:

Browser AzureCloudShell 2018 04 23 17 26 31

For more information check out Azure Cloud Shell documentation.

Be Creative

One thing I love about using PowerShell Studio by SAPIEN Technologies is the ability to be creative! The only limitation we put is on ourselves, so why not take it further with the Azure Cloud Shell?

This is a good opportunity to take a moment and check out all of the Windows Controls that PowerShell Studio has available for building GUI forms:

GUI Control Toolbox 2018 04 23 17 31 32

Let’s be creative and build a GUI form that uses the WebBrowser Control to host the Azure Cloud Shell.

Build A Simple GUI

We can build a simple GUI and incorporate the WebBrowser control with the following steps:

Open a new empty form: File > New > New Form > Empty Form:

GUI 01 2018 04 18 17 44 26

When the form opens, in the Properties panel change the Text property name from “Form” to “MyAzureCloudShell“:

GUI 02 2018 04 23 17 44 26

From the Toolbox panel > drag/drop the WebBrowser control into the new form.

If necessary, resize the form in the Forms Designer:

GUI 03 2018 04 23 17 44 26

To preview the form > on the Home ribbon > select Run.

PowerShell Studio will prompt you to save the form > Enter an application name. It is also recommended to provide a folder name to create the executable:

GUI 04 2018 04 23 17 44 26 

To complete the application we need to add the hypertext URL “http://shell.azure.com” to the WebBrowser control.

Click on the form where the webbrowser1 was added.

In the Properties panel > under the Behavior section > in the URL field > enter the value “http://shell.azure.com“:

GUI 06a 2018 04 23 17 44 26 GUI 07 2018 04 23 17 44 26

To preview the new application you will need to Sign In or Create an Azure account. A login message will be displayed when the application opens:

MyAzureCloudShell 01 2018 04 18 11 43 47

Preparing Application Settings

Now, after successfully testing the MyAzureCloudShell application, we are ready to create the executable.

In PowerShell Studio, on the Deploy ribbon, in the Packager section, select Settings:

DeploySection 01 2018 04 23 17 31 32

There are five Script Packager settings. We only need to configure the first four:

Gui 08 2018 04 23 18 12 49

Script Engine – Identify which script engine will be used to build the application.

Select the Target as “Microsoft Windows 64 bit” and the Script Engines as “SAPIEN PowerShell v5 Host (Windows)“:

ScriptEng 2018 04 18 21 11 30

Output Settings – In the Engine Settings section, designate the Output file name, and the Output folder name where the executable will be created. The rest of the fields are optional:

OutputSett 2018 04 23 18 17 07

Execution Restrictions – In the Operating Systems section, select which Windows Operating Systems the application will execute (Window 7 – Windows 10):

Exec Restrict 2018 04 23 18 18 24

Version Information – Enter any application specific version information:

Version Info 2018 04 23 18 19 39

After you have completed selecting all of the required application settings, click OK. Now, it’s time to build the application executable.

Build Application Executable

There are two options to create the executable:

Build – This option only builds the application executable.

Build & Run – This option builds the application executable and then executes the application.

Select the Build & Run option:

BUildRun 2018 04 23 18 21 16

AppDone 2018 04 23 18 23 27

And, we are done!

Recap

This article showed how easy it is to build a simple and practical Windows application with PowerShell Studio with only one Windows Forms Control.  In this example we extended a browser-based tool to a Windows Application that can allow multiple executable instances when needed.

MySAPIEN AzureCloudShell 2018 04 17 19 49 27

Go ahead and try it out!

If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.
Copyright © 2024 SAPIEN Technologies, Inc.