Here’s the scenario: You are working with Azure Automation and out of the blue, you start getting the error Invalid JSON primitive: Import-Module as depicted in the image below. Before changing your code (and I mean tearing up the code itself, modules, etc.) do yourself a favor and check the JSON file. Most of the time it is just bad formatting on the JSON file — missing a bracket, comma, or something like that.
Yes, sometimes it’s the simplest thing that trips you up.