Once you’ve deployed resources in Azure Portal for a while, it doesn’t take long until you start getting sick of going through pages and pages of options. If you have a keen eye, you may have noticed the Download a template for automation link once you’ve reached the Review + create step.
Click the link and you’ll be greeted with a wall of JSON, which is the format used by ARM (Azure Resource Manager) templates. Much like how selections in Windows Servers Manager ultimately boil down to a PowerShell command for final execution, selections in Azure Portal ultimately boil down to an ARM template for deployment.
So, if you’re trying to deploy something in Azure over and over again, you can just download the template and insert appropriate parameters, right?
Well, in theory, yes. But have you SEEN an ARM template? If you’re an old-school point-and-clicker like me, you would immediately close VS Code and go back to taking screenshots of your deployment process.
But wait, don’t give up yet.
Microsoft acknowledged the ugliness of JSON based deployment and responded with yet another programming language called Bicep (Get it? Deploy ARM templates with Bicep?). As reluctant as I am to learn yet another programming language when I’m already mediocre at half-dozen others, I think this whimsically named language is worth a look.
The following YouTube video by Casey Mullineaux does a great job of explaining why. It’s within the context of deploying Sentinel, but the same concept applies to any other Azure resource you wish to deploy (start at 5:23):
Before we go on
I’m currently going through the Microsoft Learn Bicep module, and I have to say it’s excellent: https://docs.microsoft.com/en-us/learn/paths/fundamentals-bicep/
If your goal is to easily deploy one or two resources quickly, you could always run PowerShell commands. Copy-and-pasting commands is faster and more accurate than clicking through pages of web forms. Microsoft calls this imperative code, which is to say, you tell Azure how to deploy resources step-by-step.
This is in contrast with declarative code, which describes what the finished deployment looks like, and Azure figures out how to get there. This is how Bicep works, and it really starts to flex when combined with Azure Pipelines. https://docs.microsoft.com/en-us/learn/paths/bicep-azure-pipelines/
Using Azure Pipelines allow you to deploy a template across multiple clients once, then make modifications once when needed. If you relied on PowerShell, you’d have to log in to each client to run the new code one-by-one. Having said that, if you just need to deploy something quick and dirty, PowerShell is the way to go.
I plan to make more posts on this topic once I finish the Microsoft Learn Bicep module. There’s certainly a lot to learn but the potential payoff is HUGE. Get ready to flex some muscles.
For best results, install the latest PowerShell as well as the AZ module
Installing Azure Az Powershell module
winget install -e –id Microsoft.Bicep