Deploy an Azure Automation Runbook With PowerShell

The following will walk through the steps to deploy a PowerShell 5.1 and 7.1 runtime, Azure Automation Runbook, using PowerShell. This may be necessary if you are using a deployment script in a pipeline. There are two different methods to this depending on if you are deploying a runtime type of PowerShell 5.1 or PowerShell 7.1. If you want to use the ForEach-Object -Parrallel feature for example, then you will have to use PowerShell 7....

April 2, 2023 · 3 min · Mark kerry

Automated Autopilot Tenant Move Part 2: Using PowerShell and Graph

Following on from my previous post, this one provides a far simpler process to automatically de-register your Windows Autopilot devices from one tenant, and provision them in another tenant. It’s not exactly a “part 2”, rather a different, simpler approach. I came across a great post on MsEndpointMgr which details the steps to extract your Autopilot profile in the new tenant, and copy to the machines in the old tenant ready for them to be wiped....

October 31, 2021 · 6 min · Mark kerry

Automated Autopilot Tenant Move Part 1: Using Graph, Azure Functions and Azure Storage

Thanks to Powers-Hell (Ben) for the handy Get-AuthHeader and Invoke-GraphCall PowerShell functions. Introduction There may be a scenario where you need all of your Intune managed, Autopilot registered devices setup on a new tenant. But there are a few challenges you will face: An OEM may have uploaded every device’s hardware hash to Autopilot, so you do not have them to upload to the new tenant. An Autopilot device cannot be deleted from the registration service while it’s a “managed device” (enrolled in Intune)....

September 26, 2021 · 7 min · Mark kerry

Azure ARM Templates - Part 3: Deployment

In the third and final post of this series I’ll quickly cover the process to deploy the ARM template with PowerShell Deploy Open PowerShell and change directory to the location of your ARM template and parameter files. Then complete the following commands to connect to Azure and create a Resource Group to deploy the resources to: # Import the Azure Az PowerShell Module Import-Module -Name Az # Connect to Azure and authenticate Connect-AzAccount # Create the Resource Group New-AzResourceGroup -Name "rg-eu-vm" -Location "westeurope" Once the Resource Group has been created it’s time to deploy the resources using the New-AzResourceGroupDeployment cmdlet....

July 4, 2021 · 2 min · Mark kerry

Azure ARM Templates - Part 2: Testing

Following on from authoring the Azure ARM Templates - Part 1: Development post, in this one I will cover testing the ARM template. Two potential ways to test the ARM templates is by manually building a Pester test, and another is by using Microsoft’s Azure Resource Manager Template Toolkit (arm-ttk) module. You can run local tests against ARM templates using PowerShell - which I will demonstrate in the post - but most commonly template testing and validating is used during a CI pipeline....

July 3, 2021 · 4 min · Mark kerry

MSIPatches PowerShell Module

I created a PowerShell module a few years back to safely purge the C:\Windows\Installer directory of any orphaned MSI patches. This directory can often grow very large in size due to applications such as Microsoft Office (MSI not Click-to-Run) being regularly patched. Superseded patches get left behind leaving them in an orphaned state. The MSIPatches module can detect and move the orphaned patches freeing up valuable disk space. This module requires the MSI module by Heath Stewart, which will be automatically installed when MSIPatches module is installed....

May 28, 2021 · 3 min · Mark kerry

Serverless LAPS Azure Function and Proactive Remediation

Based on the great solution created by John Seerden with a little help creating and deploying Azure Functions by the Serverless on Azure YouTube channel. All of the code in this post can be found in my GitHub repo I am only posting a few differences here, such as creating the Azure resources using AZ CLI and creating/testing/deploying the function using the Azure Functions Core Tools CLI. What is Serverless LAPS Local Admin Password Solution (LAPS) is a great solution from Microsoft to allow IT admins to automatically recycle local admin accounts on domain joined Windows machines....

April 25, 2021 · 9 min · Mark kerry