What's Bicep on Azure and why you should use it?
To generate resources automatically in Azure, you could either do Azure Resource Manager templates, which no one really wanted to do because they are far too complex and clumsy - or use third-party solutions Terraform and Pulumi.
After many years, Microsoft has finally recognized this and has created a declarative language that should solve this problem - and actually does: Bicep.
Even I, who always avoided ARM templates - now write Infrastructure as Code with Bicep!
The base of every Azure Resource is always a Resource Group, this would look like this via Bicep:
var name = 'MyResourceGroup'
var location = 'GermanyWestCentral'
resource rg 'Microsoft.Resources/resourceGroups@2021-01-01' = {
name: name
location: location
}
So simple - and even variables are supported!
Compared, no joke, the hell of ARM:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"rgName": {
"type": "string"
},
"rgLocation": {
"type": "string"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2018-05-01",
"location": "[parameters('rgLocation')]",
"name": "[parameters('rgName')]",
"properties": {}
}
],
"outputs": {}
}
Bicep is so much better!
Bicep
Bicep is a declarative language that has taken the best components from Terraform, Pulimi, and Azure Resource Manager templates, but has also learned from open source approaches like Farmer.
The result is a wonderful, but proprietary language for handling Azure services and resources.
From day one, Microsoft has focused on simplicity during development, something they have always disregarded with ARM templates.
However, one must know: Bicep virtually compiles the declarative language into ARM templates: only the developer and IT person don't notice it.
Share via Azure Container Registry
The creation of a bicep registry is also supported. For this purpose, it is possible to upload Bicep templates or Bicep modules to an Azure container registry, and thus make them available to others securely and centrally - even in a professional DevOps process!
Create private registry for Bicep modules
Conclusion
This should only be a short insight and hint, from myself as a developer: Bicep can also make a developer!
It is super simple, very intuitive and easy as pie!
It works. For everybody.