Dive into Azure Bicep Syntax & Fundamentals
Introduction
Hi there everybody! In our earlier periods, we’ve been on a journey exploring Azure Bicep. We’ve seen what it’s and the way it compares to ARM templates, and we even bought our palms soiled by organising the environment and creating our first Azure Bicep file. Right this moment, we’re going to dive a bit deeper. We’ll discover the syntax of Azure Bicep, which I imagine you’ll discover fairly intuitive and straightforward to understand.
Logging in to Azure
Earlier than we begin, let’s guarantee we’re logged into Azure. Right here’s how you are able to do it.
- Open your terminal or command immediate: You need to use any terminal or command immediate that you simply’re comfy with.
- Log in to Azure: Use the az login command to log in to Azure.
# Login to Azure az login
- Set your subscription: Use the az account set command to set your subscription.
# Set your subscription az account set --subscription "YourSubscriptionName"
Azure Bicep Syntax
Now that we’re logged in, let’s get to the enjoyable half – Azure Bicep syntax. Listed here are some key parts:
Parameters
Parameters are just like the inputs to your Bicep file. You may outline a parameter utilizing the param key phrase.
param storageAccountName string = 'mystorageaccount'
Assets
Assets are the Azure sources that you simply wish to deploy. You may outline a useful resource utilizing the useful resource key phrase.
useful resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' = {
title: storageAccountName
location: resourceGroup().location
sku: {
title: 'Standard_LRS'
}
form: 'StorageV2'
}
Variables
Variables are just like the constants in your Bicep file. You may outline a variable utilizing the var key phrase.
var location = 'westus'
Outputs
Outputs are the outcomes which might be returned after deployment. You may outline an output utilizing the output key phrase.
output storageAccountId string = storageAccount.id
Conclusion
Properly performed! You’ve simply discovered the syntax of Azure Bicep and methods to outline parameters, sources, variables, and outputs. In our subsequent session, we’ll discover parameters in Azure Bicep in additional element. So, keep tuned and continue learning!
Know extra about our firm at Skrots. Know extra about our companies at Skrots Providers, Additionally checkout all different blogs at Weblog at Skrots