Azure Automation DSC Config example

There’s a couple of ways to do DSC on Azure, you can deploy a template and use the DSC extension resource to deploy DSC configuration to your VM (simple for quick simple deployments), or you can leverage Azure Automation as a DSC Pull server (subject of this blog), where you store all your DSC configuration scripts, MOF files and manage all your DSC nodes, to see drift, compliance etc. This blog post discusses my github repo, which: Deploys an Azure VM Deploys a vNet into a separate Resource Group (Cross Resource Group Deployment), a resource group used for shared resources…

DSC Troubleshooting

If you want to troubleshoot DSC (Desired State Configuration)… You can easily run a DSC config script locally on your computer, apply the MOF manually on-demand and watch it apply in realtime as per the below. The below are the lines of PowerShell code you need for testing. First though, make sure you run the entire DSC Configuration block of code – so it’s in memory, similar to how a function behaves. In the example below, my DSC configuration file is called ‘Main‘. If you want a full demo of DSC, check out my other blog.

Log Analytics Data Collector API

Grab data/information from anywhere and store this in Log Analytics. Basically any log, any OS, any type of data can be captured on a loop and sent to a Log Analytics workspace on a constant basis, then can be used to pull out reports etc. My example below pulls the ‘Current Playing Song‘ out of radio station websites, it runs through many radio stations, at the end converts the aggravated results to JSON, then the data is sent to the Custom Log in Log Analytics using the API. You can run the script below on a regular basis, e.g. set…

Change Azure Storage Blob Tiers

Imagine you had a whole lot of data stored in Azure, you also want to save the most money in storage costs. By default, Azure Blob Storate is set to the Hot tier for all blobs, the most expensive storage costs, but the cheapest to read. To give you an idea of the cost savings, here are General Purpose v2 storage account pricing below as of time of publication in US dollars:   HOT COOL ARCHIVE Storage | First 50 terabyte (TB) / month $0.0208 per GB $0.0152 per GB $0.0025 per GB Storage | Next 450 TB / Month $0.02 per GB $0.0152 per…

Move VMs from & to anywhere in Azure

Automatically move VMs from anywhere & to anywhere in Azure: Move VMs across subscriptions Move VMs across tenants In the same region or across regions No downtime on the source VM (if there’s no data disks), the source VM remains in-tact Copies both the OS disk and any data disks attached to the VM Both Standard & Premium managed disks supported Works with ARM Managed Disk based VMs only. This script is fully automatic and cleans up temp disks & storage accounts at the very end. It shows the copy process and doesn’t waste time by coping white space on…

Change Azure ARM VM OS disk

Sometimes you would want to create an Azure ARM based Virtual Machine using an existing VHD disk. It used to be much easier in ASM (Classic). However you can easily swap out the OS disk for a VM using PowerShell. This post focuses on swapping un-managed disks, however you can swap out managed disks now, since April 2018. Simply create a new (non-managed disk) based VM in Azure with new disks. Then you use PowerShell to swap out the OS disk with an existing disk. Good news is that the OS disk doesn’t have to be sysprepped, simply swap the…