Giter Club home page Giter Club logo

bicep-azdevops's Introduction

Bicep

This demo showcases how you can create an Azure PaaS solution with Bicep.

Prerequisites

  • Have Azure CLI installed
  • Visual Studio Extension for Bicep language support
  • Install Bicep
az bicep install

Create bicep file

  • Create an infra.bicep file

  • Open in Visual Studio Code

  • Use often Ctrl + Space to get some intellisense

  • Configure the targetScope

targetScope = 'subscription'

Configure parameters

  • Configure the parameters as provided in the infra.bicep file

Configure variables

  • Configure the variables as provided in the infra.bicep file

Configure resource group

  • Create a resource group with the required properties intellisense

  • Complete like in the infra.bicep file

Deploy the template

  • Open PowerShell

  • Login with Azure CLi and select the right subscription

az logout
az login --tenant <tenant-id>
az account set --subscription <subscription-id>
cd infra
  • Deploy the Bicep template without passing parameters
az deployment sub create --location 'westeurope' --template-file infra.bicep
  • Provide the mandatory parameters inline:

    • env: dev
    • storageAccountSku: Standard_LRS
    • appServicePlanSku: F1
  • Deploy the Bicep template with inline incorrect parameters

az deployment sub create --location 'westeurope' --template-file infra.bicep --parameters env=develop 
  • Deploy the Bicep template with inline correct parameters
az deployment sub create --location 'westeurope' --template-file infra.bicep --parameters env=dev storageAccountSku=Standard_LRS appServicePlanSku=F1
  • Create an ARM parameter file infra.parameters.dev.json
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
  "env": {
      "value": "dev"
  },
  "storageAccountSku": {
      "value": "Standard_LRS"
  },
  "appServicePlanSku": {
      "value": "F1"
  },
  "location": {
      "value": "westeurope"
      }
  }
}
  • Deploy the Bicep template with the parameter file
az deployment sub create --location 'westeurope' --template-file infra.bicep --parameters ./infra.parameters.dev.json 

Create Storage Account

  • Create new module in modules subfolder, named storageaccount.bicep

    • This showcases loop
    • This showcases parents
    • This showcases outputs
  • Consume this module from within the infra.bicep file

Show complete example

  • Visualize the Bicep file via F1 > bicep: Open Visualizer

bicep-azdevops's People

Contributors

your-azure-coach avatar toonvanhoutte avatar

Stargazers

Mario Saccoia avatar  avatar Janne Kujanpää avatar  avatar  avatar Irwin Strachan avatar Jonah Andersson avatar Frédéric De Smet avatar Matrix Decoder avatar  avatar Glenn Versweyveld avatar

Watchers

Mario Saccoia avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.