Getting Started with Azure Bicep

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we get started with azure bicep [Applause] [Music] hello everyone i'm travis and this is raltos bicep is azure's new domain specific language or dsl used to create and deploy resources in azure it's a simplified alternative to arm templates bicep addresses a common complaint about the complexity of authoring arm templates json formatting can be error prone and difficult to get started with especially if the person getting started doesn't have a programming background i personally don't mind working with json templates but i dedicated a lot of time to figuring them out and still run into formatting issues from time to time i'm excited about bicep because authoring templates is so much easier in this video we're going to get started with bicep by preparing the development environment and creating a simple bicep template before we get started please like subscribe and click the bell icon for notifications of new content also if you're interested in windows virtual desktop check out my course zero2hero with windows virtual desktop on udemy.com azure already provides a way of writing and deploying resources with arm templates bicep does not replace arm templates if you have a collection of arm templates they'll continue to work matter of fact arm templates are still used in bicep they just work behind the scenes a bicep file can be converted to arm templates and templates can be converted to bicep files but that's not required to deploy a bicep file in this video we're going to add the prerequisites required to create a bicep file and deploy resources in azure then we'll create a simple storage account and test functionality there are three items needed to get started with azure bicep the bicep extension for vs code we could create bicep files with any editor but vs code with the bicep extension has autocomplete and built-in validation we also need the bicep cli this is used to compile bicep files to arm templates and decompile arm templates to bicep files a bicep file does not have to be compiled to an arm template to use it as you'll see coming up and finally we need the azure cli version 2.20.0 or the powershell azure module 5.6 or newer let's get started with installing the components for our development environment and then creating a storage account let's get started in vs code by installing the extension go to extensions and search for bicep and click install it's that easy let's move on to installing the bicep command line interface there are a lot of installers available for linux mac or windows i'll leave the link to this page below for this example we'll download and install the windows version download the installer or use one of the other methods available whatever you prefer and let's run the installer i'll accept the agreement we can leave the install directory as default and install that doesn't let's go back to vs code let's verify the version by typing bicep dash dash version that looks good and you do need to close and restart vs code for it to load the bicep cli next let's install the azure cli which is different from the bicep cli i prefer powershell but i know some people prefer the cli instead so we'll try both we'll get the current release and once that's done downloading we'll install it accept the terms and install there it finished let's go back to vs code next we have to either install or upgrade the powershell az module this requires the powershell a z module 5.6 or above let's start by getting the current installed modules this is new so there's none next let's verify the version of powershell powershell 7 is recommended for bicep we'll use the ps version table dot ps version command and here we have powershell 7. since this doesn't have the azmodule we can use the install module command to add the az module we'll pass the name az the scope is current user we'll use the ps gallery repository add force this will take a minute to finish i did run on to a problem on another computer where i wasn't able to upgrade or remove the older az module i'll leave a link in the comments to some troubleshooting steps but basically i had to install the new az5.6 module next to the older one after that it used the newer module and everything worked fine we'll give this a couple minutes to finish i'll pause here and come back once it's done that finished let's verify the version of the az module i'll use get installed module and pass in a z five nine so that meets the requirements of five six or higher now that we have the bicep extension the bicep cli the azure cli and the latest version of the powershell az module our development environment is ready let's move on to creating a resource with azure bicep we'll start by creating a storage account honestly when i started creating this video i wanted to do something a little more complex but quickly reconsidered that a storage account may be basic but it's a good starting point for understanding bicep start by creating a new file with a dot bicep extension this one is called storage dot bicep the first thing we'll add is the name and the type of resource start by typing resource and you can use tab to autocomplete because we have the bicep extension and vs code next is the name this is not the name that will be applied to the resource this is a symbolic name as bicep files get larger and more resources are created we can reference the resource in the file with this name this one will be called storage add a space and we'll get a bunch of resource types type storage account make sure storage accounts is selected and hit tab next we have the api version the latest non-preview is on the top select that one and again just hit tab notice the red squiggly line hover over that it's telling us it expects an equal sign let's add an equal sign again with the red squiggly line this time it's telling us it needs curly brackets hit space once and select the curly brackets we need some information to build a storage account notice the red squiggly line again under storage that will tell us what we need at a minimum we need the name sku kind and location let's add those next start with name and again use tab to autocomplete that will add the colon after name now we need to add the actual name this will be the name of the resource in azure we'll do space single quotes and type in a name remember a storage account has to be globally unique in this example i'll add some random digits to the end let's go to the next line and add skew notice this time it's expecting an array the sku is a name value pair let's add another set of curly brackets add name more specifically this is the sku name click space and select the sku standard lrs for this example we'll go down to the end of sku and go to the next line from here we'll add kind this kind will be storage v2 go to the next line and this time we'll add a location central us for this example that's the minimum required to create a storage account notice the red squiggly line under the symbolic name storage is gone now click save once finish and let's move on to deploying with powershell next verify you're logged into the subscription and create a new resource group with the new az resource group command this one we'll call bicep test rg and the location will be central u.s that looks good verify your cursor is in the correct location or you'll have to use a path to the bicep file we just created in the next step deploy the storage account using the new az resource group deployment command give it a name we'll just call this test specify the resource group we just created add a template file for the template file specify the bicep file we just created storage.bicep for this example once that's added run the deployment this will take a minute to finish pause here and come back once it's done it looks like it finished let's run the get easy storage account next to verify the new storage account we'll give it the name of the resource group we just created there it is let's do the same but with the command line interface next start by changing the name of the storage account storage accounts have to be globally unique we can't add the same one twice i'll just update the last digit to a two and be sure to save make sure you're logged in and run az deployment group crate passing in the resource group name and add the parameter template file and pass in the name of the file we just updated run the command to create the new storage account again this will take a minute to finish pause here and come back once it's done that finished let's get the name of our storage accounts next use the az storage account list command we'll pass in the resource group bicep test rg and we'll query on the value of dot name there they are those are the two storage accounts that is the very basics of creating and deploying a bicep file that is the very basics of creating and deploying a bicep template file to azure i hope you found this information helpful be sure to subscribe and thanks for watching
Info
Channel: Travis Roberts
Views: 24,613
Rating: undefined out of 5
Keywords: Azure, Bicep, Azure Bicep, VSCode, VS Code, extension, Azure CLI, Bicep CLI, storage, azure storage account, Bicep tutorial, azure tutorial, training, free training, PowerShell, .bicep, azure bicep tutorial, azure bicep vs arm, templates, azure tutorial for beginners, microsoft azure
Id: 77AfsFzTsI4
Channel Id: undefined
Length: 14min 29sec (869 seconds)
Published: Tue May 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.