Skip to content

πŸ’ͺ Azure Bicep Workshop: Deploy a full stack application to Azure using Bicep templates. The goal of the workshop us to learn Azure Bicep lang deploying azure landing zone and infrastructure for full stack application. The workshop starts with creation of a management group structure followed by RBAC as code and policy as code concept (custom rol…

License

Notifications You must be signed in to change notification settings

erudinsky/Azure-Bicep-Workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

99 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

azure-bicep-workshop

Introduction

Welcome to Azure Bicep workshop.

Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. In a Bicep file, you define the infrastructure you want to deploy to Azure, and then use that file throughout the development lifecycle to repeatedly deploy your infrastructure. Your resources are deployed in a consistent manner.

We are going to deploy a full stack application to Azure in multiple environments reusing Bicep templates.

Learning objectives:

  • Infrastructure-as-Code 101
  • ARM and Bicep
  • Full stack app
  • Authoring, best practices
  • DevOps

Prerequisites:

  • Fundamental cloud computing knowledge about Microsoft Azure
  • Azure subscription (if you don't have, check how to get started)
  • Visual Studio Code (VSC) with Bicep extension
  • Azure CLI version 2.71 (or above), check how install
  • You can also install Bicep CLI manually as described here, but Azure CLI should be able to do this once you execute command that needs Bicep transpiler

Prerequisites checks:

We recommend to follow this workshop using Linux or MacOS terminal, for Windows users it's best to install WSL. Open up your VSC and using terminal window check the following:

# 1. Check version of the Azure CLI
az --version

# 2. Login to Azure Portal
az login

# 3. Create a resource group
az group create -g azure-bicep-worshop-rg -l westeurope

# 4. List resource groups (table output)
az group list -o table

# 5. Delete a resource group
az group delete -g azure-bicep-worshop-rg

Selecting location for the resources you need to keep in mind two things: latency (this website helps to measure it) and products available by region.

Make sure all 5 steps from the above give no errors. If you have access to multiple Azure tenants and subscriptions, double check your workspace and set proper subscription so you won't get any surprises:

# 1. List subscriptions (table output)
az account list -o table

# 2. Set an account (should be marked "True" in "IsDefault")
az account set -s <SubscriptionId>

Repository

Make sure that you have GitHub account! If you don't please follow this link to create one. It should take less than a minutes to register.

Once you have account you need this content. The easiest way to work with it is to fork this repo.

GitHub fork

Forked repository can be cloned to your local machine for further changes. You can also propose pull request to the origin repo πŸ™

Workshop

We are going to deploy an infrastructure in Azure for full stack application using Bicep:

Full Stack Application in Azure with Bicep

You can follow the workshop by checking the following links:

  1. Getting started with Bicep
  2. RBAC as code
  3. Policy as code
  4. Secrets
  5. Prepare database
  6. Server side
  7. Client with vue.js
  8. DevOps
  9. Clean up

Repo structure (pretty much self-explanatory)

.
β”œβ”€β”€ Labs
β”‚   β”œβ”€β”€ 1-rbac
β”‚   β”œβ”€β”€ 2-policies
β”‚   β”œβ”€β”€ 3-keyvault
β”‚   β”œβ”€β”€ 4-full-stack
β”‚   β”œβ”€β”€ 5-server
β”‚   β”œβ”€β”€ 6-client
β”‚   β”œβ”€β”€ db
β”‚   β”œβ”€β”€ modules
β”‚   └── postman
β”œβ”€β”€ README.md <========= this file
└── Workshop
    β”œβ”€β”€ 0-Getting-started-with-Bicep.md
    β”œβ”€β”€ 1-RBAC-as-code.md
    β”œβ”€β”€ 2-Policy-as-code.md
    β”œβ”€β”€ 3-Secret-management.md
    β”œβ”€β”€ 4-Prepare-database.md
    β”œβ”€β”€ 5-Server-side.md
    β”œβ”€β”€ 6-Client-with-vuejs.md
    β”œβ”€β”€ 7-DevOps.md
    └── 8-Clean-up.md

You can also follow this workshop by watching two videos:

Shortcut

In case you can't wait and want to deploy everything in one go, proceed with template.

templates
β”œβ”€β”€ main.bicep
β”œβ”€β”€ main.init.bicep
β”œβ”€β”€ modules
β”‚   β”œβ”€β”€ acr.bicep
β”‚   β”œβ”€β”€ keyvault.bicep
β”‚   β”œβ”€β”€ postgres.bicep
β”‚   β”œβ”€β”€ staticsite.bicep
β”‚   └── webapp.bicep
β”œβ”€β”€ parameters.gh.json
└── parameters.init.gh.json
  1. Generate using az-cli Service Principal: az ad sp create-for-rbac --name AzureBicepWorkshop --role Owner --scopes / and add AZURE_CREDENTIALS variable using this doc
  2. Add remaining environment variables (secrets) in your project as described here
  3. Make changes in parameters.gh.json and parameters.init.gh.json
  4. Commit and push changes, GH workload should pickup several pipelines!

Author

Hi there πŸ‘‹

I’m Evgeny Rudinsky, a consultant based in The Netherlands and the creator of this workshop. My expertise lies in DevOps, cloud-native technologies, and application security, with a strong focus on Microsoft Azure. I specialize in designing and implementing robust cloud solutions and hold several Azure certifications, including Azure Solution Architect Expert, DevOps Engineer Expert, Azure Security Engineer, Azure Administrator Associate, Azure Developer Associate, and Identity and Access Administrator Associate.

I'm a Microsoft MVP in Azure Infrastructure as Code area.

MVP Badge

Feel free to follow me on X (Twitter) @evgenyrudinsky, LinkedIn and explore my blog for insights on DevOps, cloud-native technologies, and application security.

Good luck with the workshop! πŸ€

Contributing

Contributions are welcome! If you'd like to contribute to this workshop, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with clear and concise messages.
  4. Push your changes to your forked repository.
  5. Open a pull request to the main repository.

For more details, please refer to the CONTRIBUTING.md file.

We appreciate your contributions! πŸ™

About

πŸ’ͺ Azure Bicep Workshop: Deploy a full stack application to Azure using Bicep templates. The goal of the workshop us to learn Azure Bicep lang deploying azure landing zone and infrastructure for full stack application. The workshop starts with creation of a management group structure followed by RBAC as code and policy as code concept (custom rol…

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published