Overview if Biceps

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 All you Need - Azure Templates : https://learn.microsoft.com/en-us/azure/templates/


Biceps Playground :
https://bicepdemo.z22.web.core.windows.net/

 https://www.youtube.com/watch?v=Tmv9qh6EaJs&list=PLZ1A-UOV76etaV-zD_aSsW0Y1MIW55dve&index=4

Pipelines : https://learn.microsoft.com/en-us/training/paths/bicep-azure-pipelines/

Biceps Template : https://learn.microsoft.com/en-us/azure/app-service/samples-bicep

Azure Resource Manager Doc : https://learn.microsoft.com/en-us/azure/azure-resource-manager/

 "When deploying Azure resources with an Infrastructure as Code tool, you need to understand what resource types are available, and what values to use in your files. The Azure resource reference documentation provides these values. The syntax is shown for Bicep, ARM template JSON, and Terraform AzAPI provider."

 https://learn.microsoft.com/en-us/azure/templates/


Azure Docs : https://learn.microsoft.com/en-us/docs/





+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 Visual Code Extensions for Bicep : -







The most common one is IAC :

What is IAC ?


Biceps is kind of wrapper on top of ARM templates.

Biceps are converted into ARM Templates and then submitted to ARM engine. And your Azure resources will be created on the Azure



Bicep has a playground and this screen shot has been taken from there .


Hello world code above take only a few lines of code using Biceps while ARM template code for Helloword on the right.

Azure Bicep Setup

Setting up a local environment

1. The first and foremost thing that you need to have to work with Bicep is Azure CLI

2. Then we Install Bicep CLI, Biceps CLI depends on Azure CLI



Once these two are installed in the local machine .

The next thing that you to work with is the Visual Studio Code .

There are couple of ways to execute the bicep script.

-- Azure CLI
-- Powershell





We will look at installing both of them . There are other things that we also need to install to improve the productivity of Bicep scripts.

1. Biceps Extension for Visual Studio Code
2. ARM tools extension for Visual Studios

ARM tool is not mandatory but this will improve your productivity if we are using ARM Templates .Why we are installing today is for comparing authoring ARM templates and with Bicep templates.

Installing Azure CLI : https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

Installing Biceps CLI : https://github.com/Azure/bicep

Windowx/ Linux / Mac

Install the following on Visual Studios.

Next Install Bicep extension on Visual Studios
Microsoft ARM Tools extension on

 

Azure Biceps -- Hello World Program

We will make a comparison between ARM Template Vs Biceps by checking how simple Biceps is while coding compared to ARM Template.

1. armtemplate.json

type "arm" and click on this -- this will create a basic structure. 

This is the structure it creates.


Inside Output.

Click Ctl + Space




Now to execute this command it expects you to have a resource group .He goes to the portal and creates Resource . 

First login into Azure

> az login

This command take you to the Azure Web page . Right now I have multiple subscription , we need to set a subscription . 

copy the subscription id

and 

az  set account --subcription <Paste your subscription id>

Now run

az deployment group create --resource-group <resource-gp> --template-file armtemplate.json

Go to resource group click on nodeployments -- you will see this deployment.



Click on Template on the left you will see the ARM Template submitted to Azure.

 


Now lets see how Bicep does it.

create a file > biceptemplate.bicep

script looks like below

output Greeting string = 'Hello-World from bicep'


az deployment group create --resource-group <resource-gp> --template-file biceptemplate.bicep

The  bicep code has converted to an ARM template.



What is Bicep Templates ?


Creating a Azure Resource Group Using Biceps



n Bicep, the targetScope attribute specifies the scope at which your resources will be deployed. The targetScope determines where the resources will be provisioned. There are three possible values you can set for targetScope:

  1. Resource Group ('resourceGroup'): If you set targetScope to 'resourceGroup', the resources defined in your Bicep file will be created within the same resource group as the Bicep deployment.

  2. Subscription ('subscription'): If you set targetScope to 'subscription', the resources will be created directly at the subscription level, rather than within a specific resource group.

  3. Management Group ('managementGroup'): If you set targetScope to 'managementGroup', the resources will be created at the management group level.

In your provided Bicep code snippet:

>>>>>> In the portal choose the subscription -- in the deployment click on the deployment. 


Azure Bicep : Creating App Service Plan

App service plan : for running your applications

What is an App Service Plan ?

An App Service Plan is a concept within Microsoft Azure that defines a set of computing resources for hosting web applications, APIs, and mobile app backends. It's a fundamental element of Azure's App Service, a platform-as-a-service (PaaS) offering designed for deploying and managing web apps without dealing with the underlying infrastructure.

In simpler terms, an App Service Plan determines:

  1. Compute Resources: It specifies the amount of CPU and memory resources allocated to your web apps. Higher-tier plans provide more resources for better performance and scalability.

  2. Isolation: The plan determines the level of isolation provided to your apps. Each app service plan can host multiple apps, and isolation ensures that resources are separated for different plans.

  3. Scaling Options: Different App Service Plan tiers offer various scaling options, like manual scaling, autoscaling, and load balancing. These options let you adjust resources based on app demand.

Azure offers several tiers for App Service Plans, each with its own features and pricing:

  1. Free Tier: Suitable for development and testing, with limited resources.

  2. Shared Tier: An economical option for hosting simple apps, but with shared resources.

  3. Basic, Standard, and Premium Tiers: These tiers provide dedicated resources for improved performance, scaling, and customization options.

  4. PremiumV2 and PremiumV3 Tiers: Offer more memory, dedicated virtual machines, and advanced features like virtual network integration.

  5. Isolated Tier: Designed for high-performance apps needing dedicated virtual machines and network isolation.

It provides us Linux or Windows Managed Instances

These managed Instances are managed by Microsoft



we are creating a deployment over a resource group .

az deployment group create -g azbicep_dev_eus_rg1 -f 2.AppServicePlan.bicep

currently we do not have any apps inside this.

Create App Service Plan with Linux Operating System


resource appServicePlan 'Microsoft.Web/serverfarms@2020-12-01' = {
  name: 'name'
  location: location
  sku: {
    name: 'F1'
    capacity: 1
  }
}




8 : Create App Service :

App service is  a PAAS service in Azure that helps us in creating Web Apps. Web APIs , Mobile Backends

It helps in deploying any of these applications and it also supports in 




res.resource webApplication 'Microsoft.Web/sites@2021-01-15' = {
  name: 'name'
  location: location
  tags: {
    'hidden-related:${resourceGroup().id}/providers/Microsoft.Web/serverfarms/appServicePlan': 'Resource'
  }
  properties: {
    serverFarmId: 'webServerFarms.id'
  }
}


 


The Resource Group > Resource Group Name > App Service Plan > Web Application





Azure Bicep - Learn how to preview changes before execution using What-If function


It prompts for "do you want to deploy it to Azure" . If you say yes the data will be submitted to  Azure.

Azure Bicep : Create Application Insight

On VSCode

type : app

resource appInsightsComponents 'Microsoft.Insights/components@2020-02-02' = {
  name: 'name'
  location: location
  kind: 'web'
  properties: {
    Application_Type: 'web'
  }
}

How to link Web App to App insight for this we may need Application settings. 

Go to Application Setting > Configurations >


This is how it is done using Bicep



Never do application settings manually from the Portal do it using Bicep or Arms

Now lets see how we link application insight with an app service












Comments

Popular posts from this blog

Azure - Bicep : Udmy Les : 1 :