Cloud can be tricky sometimes. Find out what scenarios we've ran into that are worth being mentioned and explained.
Microsoft introduced Azure Bicep, a Domain-Specific Language (DSL) in 2020 as an Infrastructure as Code (IaC) language to facilitate resource deployment on Azure. The language is designed to be modular, allowing reusability of work across different templates or deployments.
Since its launch, Bicep has gained popularity within the IT community, with numerous blog posts, tweets, and conference sessions on the official Bicep GitHub space. Bicep became production ready at v0.3 and is now supported by Microsoft Support Plans.
Here is an example of the basic syntax:
param webAppName string
param appServicePlanName string
var appServicePlanSku = 'B1'
var location = 'westus2'
Here is an example of the code you can use to create an App Service Plan:
resource appServicePlan 'Microsoft.Web/serverfarms@2021-01-15' = {
name: appServicePlanName
location: location
properties: {
name: appServicePlanName
workerSizeId: appServicePlanSku
}
}
Here is an example of how to do this:
resource webApp 'Microsoft.Web/sites@2021-01-15' = {
name: '${webAppName}-web-app'
location: location
properties: {
name: '${webAppName}-web-app'
serverFarmId: appServicePlan.id
siteConfig: {
linuxFxVersion: 'DOCKER|nginx'
}
}
}
New-AzResourceGroup - Name<resourse-group-name> -Location <location>
New-AzResourceGroupDeployment -Name <deployment-name>
-ResourceGroupName <resource-group-name> -TemplateFile <path-to-bicep-template
In this command, you need to provide the name for your deployment, the name of the resource group where you want to deploy the resources, and the path to your Bicep template.
New-AzResourceGroupDeployment -Name my-deployment -ResourceGroupName my-resource-group -TemplateFile azuredeploy.bicep
This command will deploy the resources defined in your Bicep template to the specified resource group.