Search for Help
< All Topics


It is often easier to develop PowerShell scripts that are intended to run in Azure by first running and debugging a copy of the script on a local desktop computer. This is how the existing Speakeasy scripts have been developed (but see the section at the end of this document for how to directly access an Azure runbook). To do this, a few steps need to be performed to make sure that all the appropriate software is configured on that computer. This document aims to highlight the requirements  to ensure successful execution of the scripts on a local computer.



The Azure Powershell scripts use two different PowerShell versions. At the time of writing, Speakeasy report generation would not work with V7.1 due to issues with the PDF component, so V5.1 was used. The following link shows the various versions used:

Speakeasy Automation Runbooks in Azure

Install V5.1 and V7.1 of PowerShell – it is recommended this is done using the latest .MSI files

Visual Studio Code

For PowerShell 5.1, PowerShell ISE can be used to develop and debug scripts. However, this is being phased out so it is recommended that Visual Studio Code be used. When trying to run PowerShell scripts for the first time in Visual Studio code, the user will be prompted to install additional addins to support PowerShell – when prompted, say yes to install them. The components below can then be installed by executing the stated commands from inside the Visual Studio Code – Terminal window.

Azure Connectivity

Install the modules that are used to establish a connection to Azure:
    Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force -AllowClobber

Sharepoint Connectivity

Install the modules that are used to establish a connection to Sharepoint:
    Install-Module -Name “PnP.PowerShell”

Exchange Connectivity

Install the modules that are used to establish a connection to Exchange:
    Install-Module -Name ExchangeOnlineManagement

Digital Certificate

For debugging of Azure-based scripts on the local desktop, need to load any digital certs into the local certificate store. The following PowerShell script will do this:

Digital Certificate Password

When executing any of the PowerShell scripts for loading or saving digital certificates, use the password which is stored in BitWarden for the entry called “Azure Digital Certificate Password”
Note: If using Visual Studio code to edit/run PowerShell scripts that involve Exchange/Sharepoint/Azure connectivity, it is recommended that Visual Studio code is restarted after the above have been installed, as the environment may not be fully configured without the restart/

Debugging and Running Azure Runbook Scripts on a local computer, without making a copy

Prior to 2023, any prospective Azure Runbook was first tested on a local computer  by taking a copy of the run book script and adding it to a file in the following folder:

Bury Speakeasy\Speakeasy IT – General\PowerShellScripts\AzureRunbookScriptCopiesForTestingLocally

This was not ideal as the developer has to be careful to keep the local copy contents in sync with the Azure runbook copy. A new extension was added to Visual Studio Code in early 2023. This enables Azure runbooks to be accessed directly in Azure, but still executed on the local computer. The following article describes how to install and configure the Azure Automation VS Code extension:

Installing the Azure Automation VS Code Extension