Azure Classroomnotes 08/Aug/2023

Infrastructure as Code

  • This is an approach of managing infrastructure where infrastructure is described in configuration files and then used to create the infra automatically.
  • Tools:
    • Azure:
      • ARM Templates
      • Bicep
    • AWS:
      • Cloud formation
    • Generic:
      • Terraform
  • Advantages:
    • Reusability
      • managing multiple environments
    • Every change in infra is version controlled

Azure Resource Manager (ARM)

  • This is the basis for Azure IaC Capabilities via ARM templates.
  • Azure provides capabilities by Resource Providers which are registered to subscription.
  • Resource Providers provide services and operations
  • refer the below image
    Preview
  • When we are using Azure either from portal/CLI/Powershell/SDK we interact with Resource providers
  • Experiment: Create a vm in Azure Portal.
    • After succesful creation, Navigate to Resource Group and then deployments, select deployment and view template
      Preview
      Preview
      Preview
  • So when we create something from azure portal it is creating template.
  • Azure CLI/Powershell and SDK directly interact with Management API of Azure to create resources where as portal tries to create a template.
  • To create custom templates for our infrastructure we need to express infrastructure as a code using ARM/Bicep.
  • ARM uses json
  • ARM has json Refer Here
  • Workflow for creating infra as code
    Preview
  • We use IaC Whenever we need to work with creating/modifying infrastructure on various environments

ARM Templates

  • Template is used to Create infrastructure. This template can be applied at multiple levels
    • Resource Group Deployment
    • Subscription Deployment
    • Management Group Deployment
    • Tenant Deployment
  • ARM Template is a json file Refer Here for the basic structure
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "",
  "apiProfile": "",
  "parameters": {  },
  "variables": {  },
  "functions": [  ],
  "resources": [  ],
  "outputs": {  }
}
  • In the above not every field is required. Bare minimum template
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "",
    "resources": [  ]
}

Exercise

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Network Widget by Acurax Small Business Website Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube