JSON and ARM Templates

ARM Templates are written with JSON and are at the core of Azure Resource Manager deployments.  I have used and developed templates for months.  Although successful, I ran into issues with formatting and syntax this week and decided to take a step back and get a better understanding of the underlying JSON used in these templates.  In this post, I start from the beginning, exploring JSON as it relates to ARM templates. Continue reading “JSON and ARM Templates”

Authentication and Azure Automation Runbooks

AzureAutomationRecently I ran into an issue with Authentication and Azure Automation child runbooks. The goal was to call a PowerShell child runbook following the documentation here. I was using the cmdlet method, starting the runbook with the Start-AzureRmAutomationRunbook command. Trying to call the child runbook from the parent, I get the error: Continue reading “Authentication and Azure Automation Runbooks”

Azure OMS Log Analytics Step by Step – Data Collector API

I see a lot of potential in Azure Log Analytics. That should go without saying considering the amount of time I have spent learning and documenting it over the past few weeks. One of the most exciting features that adds tremendous flexibility is the ability to log directly to Log Analytics with the Web API. Logging to the Web API enables anything to be written to Log Analytics without the use of the Microsoft Monitoring agent. Continue reading “Azure OMS Log Analytics Step by Step – Data Collector API”

Variables in Azure Automation

AzureAutomationShared Resources in Azure Automation allow for the reuse of credentials, modules, scheduled, connections, certificates and variables. Variable assets provide a way to share values between multiple runbooks as well as between multiple jobs from the same runbook. In this post, I outline how to reference variables that are encrypted and non-encrypted in an Azure Automation runbook. Continue reading “Variables in Azure Automation”

Writing to the Windows Event Log with PowerShell

Odds are,  you were Googling something like ‘write event log PowerShell’ and you stumbled on this page.  If that’s the case and you just want to write an event to the Event Log to test something like a monitoring or alerting app, I won’t disappoint, below is what you need to know.  If you want a little more information on writing to the Event Log as part of a script, keep going.

Write-eventlog requires 4 parameters, EventID, LogName, Message and Source.  It’s the -Source part that trip people up.  If you don’t know what the source is, simply make one up.  Create the new source with the New-Eventlog command like this:

New-EventLog -LogName <Log you are writing to> -Source ‘Make one up’

For example, Adding the source HAL to the application log looks like this:

New-EventLog -LogName Application -Source ‘HAL’

Continue reading “Writing to the Windows Event Log with PowerShell”

Write Data from PowerShell to Azure Table Storage

I worked on a project recently that wrote data from PowerShell into a CSV file.  The goal was to do real time trending based on the output, but I ran into an issue with file locks as PowerShell and the other program competed for access to the CSV.  That’s when I got the idea to write to Azure Table Storage instead of to a CSV.  The project didn’t work out for other reasons, but I did work out how to write data into Azure Table Storage instead from PowerShell.  This post is about how I did that. Continue reading “Write Data from PowerShell to Azure Table Storage”

Configuring Storage Spaces with Azure Desired State Configuration

AzureAutomationAs promised in my last post, here are the details on configuring Storage Spaces with Azure Desired State Configuration.

But first, some context

The goal is strait forward.  I  deploy multiple Windows Server 2016 VM’s and add them to the domain all with an ARM template.  These VM’s inevitably have multiple data drives just waiting to be provisioned.  Logging into each server to manually configure data drives is just not practical.  I needed a way to pool the data drives and create a  single data disk with minimal interaction. Continue reading “Configuring Storage Spaces with Azure Desired State Configuration”

PowerShell Desired State Configuration Troubles

AzureAutomationI am excited for the potential of PowerShell Desired State Configuration.  The ideal of pushing configurations with one click, making settings consistent across multiple machines is a sysadmins utopia.  But getting there can be a challenge and somewhat of a steep learning curve.

This week’s obstacle was with the PowerShell DSC script resource.  There is a lot of information available.  This Microsoft document is a good place to start. Continue reading “PowerShell Desired State Configuration Troubles”