In a nutshell:
Azure Resource Manager (ARM) streamlines resource management through templates, grouping, consistency, access control, tagging, and cost tracking.
ARM templates and Bicep make it easy to declare, repeat, and automate resource deployments.
Azure Resource Manager (ARM)
Whenever you want to create or manage stuff in Azure, ARM comes to your rescue.
ARM does a lot behind the scenes. When you send a request, ARM's the one that gets it. It makes sure you're allowed to do what you want, and then it guides your request to the right Azure service to make things happen.
Why you'll love ARM:
- Templates: ARM lets you work with templates, kind of like building blueprints. You say what you want in Azure, and ARM makes it happen. More on ARM templates below!
- Grouping: ARM helps you deploy, manage and monitor your resources as a group, which is much easier than handling resource individually.
- Consistency rules: With ARM, you can repeat your setups and re-deploy your solution - and trust they'll always be the same.
- No more chaos: ARM sorts out what is the correct order for things to be deployed, which is super handy for making sure the dependencies are getting deployed first!
- Security guru: You can implement access control for all services effortlessly because Role-Based Access Control (RBAC) is seamlessly integrated into the ARM template. Managing permissions is a breeze.
- Tagging: ARM helps you tag your stuff, like putting labels on your resources, making it easier to find them.
- Billing wizard: You can now see costs for an entire group of resources if they share the same tag!
Infrastructure as code (IaC)
Think of "infrastructure as code" as a way to manage your digital cloud with computer instructions.
For starters, it means using tools like Azure Cloud Shell, Azure PowerShell, or the Azure CLI to organise and set up your things.
As you get more experienced, you can use this idea to manage entire deployments using repeatable templates and configurations.
ARM templates and Bicep are two such tools that help you do this with Azure Resource Manager.
ARM templates
Imagine ARM templates as sets of instructions written in a special computer language called JSON. These instructions tell Azure what things you want to create or use, like websites or databases. It's like giving Azure a recipe, and it follows that recipe to make the things you need.
Fun fact: the template will verify your code first to make sure the resources will be created properly, then create all the resources at the same time once if everything looks good. That is, if you need 50 instances of the same resource, all 50 instances are created at the same time!
Why you'll love ARM templates:
- Easy declarations: Instead of complicated instructions, you declare what you want. It's like saying, "I want a bike," and it appears!
- Repeatable results: If you want to repeat something in the same way, simply use the same ARM template and you'll get consistent results.
- Automatic ordering: ARM templates take care of things in the right order. If one thing depends on another to be deployed first, it'll make sure all the dependencies are ready first so there are no conflicts. When possible, Azure Resource Manager deploys resources in parallel, so your deployments finish faster than doing things one by one.
- Lego blocks: You can break down your templates into smaller, reusable pieces, like Lego blocks. In the world of ARM templates, these Lego blocks are called modular files. You can also nest one template inside another template. For example, you could create a template for a VM, and then nest that template inside of templates that deploy entire environments, and that VM will consistently be deployed in each of the environment templates.
- Add a sprinkle of magic: ARM templates can also run PowerShell and Bash scripts* before or after setting up your resources. For example, before deploying a VM through ARM templates, you can use a PowerShell script to install database software, web servers, or additional tools needed by your VM. Once the VM is up and running, you can use a post-deployment PowerShell script to deploy your application code. This could include copying application files, changing the settings for databases, and starting services.
- *Bash scripts are like step-by-step recipes that tell your computer what to do. You can use these scripts to make your computer perform tasks automatically, like organising files, running programs, or setting up things the way you want them.
- Fun fact: Bash is a shell, just like PowerShell. It's the default shell for macOS and Linux, whereas PowerShell is used for Windows. Bash is particularly useful for automating tasks, writing scripts, and running commands.
It gets even easier than ARM templates introducing Bicep!
Bicep is like the cool, easy-to-read version of ARM templates. Bicep is another language that helps you tell Azure what you want in an easy way. You use it to describe the things you need, like virtual machines or databases, and then it makes those things happen in Azure, following your instructions.
Why you'll love Bicep:
- Friend to all resources: Bicep works with all Azure services, and keeps up with the newest ones so you don't have to wait for Bicep to update.
- Plain and simple: Bicep's language is clear and concise, no coding jargon involved.
- Repeatable magic: Just like ARM templates, Bicep brings consistency and predictability to your setups. Fun fact: a special word to describe this characteristic is indempotent, which means you can deploy the same file many times and get the same resource types in the same state.
- Automatic ordering: Just like ARM templates, Bicep makes sure resources are being deployed in the right order. When possible, Bicep also deploys resources in parallel to save time.
- Lego blocks: Just like ARM templates (for the last time!), you can build with Bicep in modular pieces, helping you reuse your work and make everything less complicated.