Kickstarting Azure Infrastructure: Azure Bicep
Introduction
In our earlier articles, we launched Azure Bicep and in contrast it with ARM templates. Now that we’ve got a superb understanding of what Azure Bicep is and why it’s a compelling different to ARM templates, it’s time to get our palms soiled. On this article, we are going to arrange the environment for Azure Bicep and create our first Azure Bicep file.
Establishing the Setting
Earlier than we begin writing Azure Bicep information, we have to arrange the environment. Listed here are the steps.
- Set up Azure CLI: Azure CLI is a command-line device that you need to use to handle Azure sources. You’ll be able to obtain it from the official Azure web site right here.
# Verify your put in model
az --version
- Set up Bicep CLI: Bicep CLI is a command-line device that you need to use to work with Bicep information. You’ll be able to set up it utilizing Azure CLI.
# Set up Bicep CLI
az bicep set up
# Verify your put in model
az bicep model
- Set up Visual Studio Code and Bicep extension: Visual Studio Code is a well-liked code editor, and the Bicep extension gives options like autocompletion, code navigation, and reside linting.
You’ll be able to set up VS Code from right here.
After getting put in VS Code, use the under command to put in the Bicep Extension.
# Open Visual Studio Code and set up Bicep extension
code --install-extension ms-azuretools.vscode-bicep
Logging in to Azure and Setting the Subscription
Earlier than deploying the Bicep file, we have to log in to Azure and set the subscription. Listed here are the steps.
- Log in to Azure: Use the az login command to log in to Azure.
# Log in to Azure
az login
- Set the subscription: Use the az account set command to set the subscription.
# Set the subscription
az account set --subscription "mySubscription"
Creating your first Azure bicep file
Now that the environment is about up, let’s create our first Azure Bicep file. We’ll create a easy Bicep file that deploys a storage account.
- Create a brand new Bicep file: In Visual Studio Code, create a brand new file with a .bicep extension.
- Outline a storage account useful resource: Within the Bicep file, outline a storage account useful resource as follows.
useful resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' =
title: 'mystorageaccount'
location: resourceGroup().location
sku:
title: 'Standard_LRS'
variety: 'StorageV2'
- Deploy the Bicep file: You’ll be able to deploy the Bicep file utilizing Azure CLI.
# Deploy the Bicep file
az deployment group create --resource-group myResourceGroup --template-file ./foremost.bicep
Conclusion
Congratulations! You might have arrange your surroundings for Azure Bicep and created your first Azure Bicep file. Within the subsequent article, we are going to dive deeper into the syntax of Azure Bicep. Keep tuned
Know extra about our firm at Skrots. Know extra about our companies at Skrots Companies, Additionally checkout all different blogs at Weblog at Skrots
Know more about our company at Skrots. Know more about our services at Skrots Services, Also checkout all other blogs at Blog at Skrots
Thanks, Harsh
Founder | CEO — Skrots
Learn more about our blog at Blog at Skrots. Checkout our list of services on Skrots. Give a look at our website design at Skrots . Checkout our LinkedIn Page at LinkedIn.com. Check out our original post at https://blog.skrots.com/kickstarting-azure-infrastructure-azure-bicep/?feed_id=6042&_unique_id=663a1442dcddc