Latest / Microsoft Cloud IT Pro Podcast / Episode 388 – Getting Started with Azure Bicep: Infrastructure as Code with a Domain Specific Language
Transcript
- 0:03Welcome to episode 388
- 0:06of the Microsoft Cloud IT Pro Podcast,
- 0:09recorded live on November 1, 2024.
- 0:12This is a show about Microsoft 365 and
- 0:14Azure from the perspective of IT pros and
- 0:17end users, where we discuss a topic or
- 0:19recent news and how it relates to you.
- 0:21It's time to switch back to an Azure
- 0:23topic this week. In this episode,
- 0:26we dive into Azure Bicep,
- 0:28Microsoft's streamlined language for defining cloud and front
- 0:31infrastructure.
- 0:32If you are new to infrastructure as code
- 0:34or looking to simplify your Azure deployments,
- 0:37listen in to learn how easy it is
- 0:39for you to get started with Azure Bicep.
- 0:44We shall be at Ignite for the entire
- 0:46week doing
- 0:47podcast stuff. Yes. So if you were going
- 0:50to be I know I already heard from
- 0:51one listener that said they're gonna be at
- 0:53Ignite and they wanna meet up. So all
- 0:55the rest of you that are gonna be
- 0:56at Ignite, let us know. We can say
- 0:59hi. You can be on the podcast. If
- 1:00you wanna be if you're at Ignite, you
- 1:02wanna be on a podcast, come find us
- 1:04and tell us you wanna be on the
- 1:05podcast. Maybe we'll let you on. Maybe. You're
- 1:07just giving folks a lot of A lot
- 1:09of optimism there. We will absolutely
- 1:12have you on the podcast because we love
- 1:15inviting our listeners
- 1:17to participate. No. It would be fun. If
- 1:19you're gonna be at Ignite, we would love
- 1:21to see you meet up. We'll be around,
- 1:23like you said, the entire week. So it
- 1:26should be fun, Scott. This is the 1st
- 1:28Ignite I have been to live and in
- 1:31person
- 1:32since 2019.
- 1:33I think so. I was trying to think
- 1:35back. I was I was talking to my
- 1:37wife last night at dinner while we were
- 1:39out about this. She's, oh, you're going back
- 1:40to that conference, the one that you used
- 1:42to go to all the time. Yeah. That
- 1:44that's the one.
- 1:45But, yeah, well,
- 1:48it's been a hot minute since we've been
- 1:50out there and and done this whole thing
- 1:52and seen people. So I'm looking forward to
- 1:55it. It also seems like they're expanding
- 1:58the pool a little bit. I think there
- 1:59were, like, more in person tickets and things
- 2:02that were made available for sale this year.
- 2:04So it's not as big as it used
- 2:06to be, but it's getting back up there,
- 2:09like, creeping up slowly.
- 2:11So that's good to see. I'm very excited
- 2:13for just a hallway track and a week
- 2:17of digging in and
- 2:19seeing what's new and what's coming. Yeah. And
- 2:22if you are, so not only are we
- 2:23gonna be there doing podcasts, Scott, I also
- 2:26these are
- 2:27I'm not allowed to share these. I did
- 2:29get confirmation this is no longer under NDA.
- 2:31I will be helping to proctor a lab
- 2:33a couple days too. So if you want
- 2:34to go learn how to supercharge charge your
- 2:36SOC with Microsoft Defender,
- 2:38it's lab
- 2:394
- 2:4059 in the session guide. My name is
- 2:43not on it. The proctors were not cool
- 2:45enough to get our names on it. Only
- 2:46the speakers that are leading the lab are
- 2:48on it, but I will be there helping
- 2:51to proctor that lab a couple of days
- 2:53as well. I think there's one on
- 2:55Wednesday
- 2:56and one on Friday.
- 2:58If you're gonna be there, you wanna learn
- 2:59about SOC and Microsoft Defender, get hands on
- 3:01with SOC and Microsoft Defender or Microsoft Defender
- 3:04for a SOC.
- 3:05Come join me in the lab too. It
- 3:07should be fun. Although, you told me I
- 3:08have a sick sense of fun when you
- 3:10told me when I told you that sounded
- 3:12like fun. You do have a weird way
- 3:13of expressing it sometimes, and I'll I'll I'll
- 3:16leave it at that.
- 3:17But, yeah, the session guides are live for
- 3:19Ignite, so that finally lit up. It's always
- 3:21a confusing experience when you go register for
- 3:24Ignite before the session guides are live, and
- 3:26it looks like the entire website's broken and
- 3:28you can't sign in or you can't do
- 3:30anything. I really don't understand why it continues
- 3:32to be that way, but
- 3:34it does.
- 3:35But session guides are live, so you can
- 3:37go through. And if you are going, you
- 3:38can figure out your week. Certainly, if you're
- 3:40attending in person or for digital attendees, you've
- 3:44also got the sessions open as well. So
- 3:47Ignite is not being gated to an in
- 3:50person only event. It's also got the digital
- 3:53component to it. So you got a couple
- 3:55days of that of being able to follow
- 3:56along with the sessions
- 3:58or the recordings if they don't fit into
- 4:01your time zone
- 4:03where you happen to reside at the time,
- 4:05things like that. So
- 4:06it's all out there and available
- 4:09and ready to go. Good times.
- 4:12So with that, announcements
- 4:15out of the way, I think. No more
- 4:17announcements. Should we talk about
- 4:19something
- 4:20Azure y? That should be a new word.
- 4:22Something Azure y today. Azure y? Let's talk
- 4:25about
- 4:26something Azure y.
- 4:31Do you feel overwhelmed by trying to manage
- 4:33your Office 365
- 4:35environment? Are you facing unexpected issues that disrupt
- 4:38your company's productivity? IntelliJunk is here to help.
- 4:40Much like you take your car to the
- 4:42mechanic that has specialized knowledge on how to
- 4:44best keep your car running, Intelligent helps you
- 4:47with your Microsoft Cloud environment because that's their
- 4:50expertise.
- 4:51Intelligent keeps up with the latest updates in
- 4:53the Microsoft Cloud to help keep your business
- 4:55running smoothly and ahead of the curve. Whether
- 4:58you are a small organization with just a
- 5:00few users up to an organization of several
- 5:021000 employees,
- 5:03they want to partner with you to implement
- 5:05and administer your Microsoft Cloud technology.
- 5:09Visit them atintelliginc.com/podcast.
- 5:13That's
- 5:14intelligink.com/podcast
- 5:20for more information or to schedule a 30
- 5:22minute call to get started with them today.
- 5:24Remember, IntelliJunk focuses on the Microsoft cloud so
- 5:28you can focus on your business.
- 5:32So for
- 5:33our Azure y topic, that should be a
- 5:35new word. I did not sleep enough last
- 5:37night, Scott. You're gonna have to try really
- 5:39hard to keep me focused today.
- 5:41We have not talked about this a ton.
- 5:43We had one recording, I think, we did
- 5:46maybe a couple years, like, ready to go
- 5:47with AC, mentioned it in passing a lot,
- 5:50but we decided
- 5:52to dive into a little bit of
- 5:55bicep
- 5:56today, not our muscles because those are sadly
- 5:59lacking, at least mine are. I will speak
- 6:01for myself, but the declaratively
- 6:05deploying Azure resources
- 6:07by step instead of using JSON templates for
- 6:11going in, creating resources, deploying resources,
- 6:15infrastructure
- 6:16as
- 6:17as code
- 6:18type of topics
- 6:20because infrastructure
- 6:21guys
- 6:22now must be developers, Scott. I have resigned
- 6:25myself to the fact that to some extent,
- 6:27we are developers now. We're not developers, but
- 6:30we're still scripters, and I I continue to
- 6:33maintain that it is helpful to
- 6:35think like a developer as an IT pro.
- 6:38Like, there are many constructs of consuming functions,
- 6:42doing
- 6:43manipulation between data types, say, casting
- 6:46integers to strings or things like that.
- 6:50There are concepts
- 6:52of object oriented programming inside of some of
- 6:55the scripting languages, especially PowerShell comes to mind
- 6:57here as something we work with every day.
- 7:00If somebody's ever worked with an object in
- 7:02PowerShell, congratulations.
- 7:03You too are now a developer.
- 7:05You've got that going for you. There there's
- 7:08just a whole bunch going on between casting,
- 7:11data types,
- 7:13consumption,
- 7:14and uses of functions, all these kinds of
- 7:17things. And I think Bicep,
- 7:19like, one of the things that can clue
- 7:20you in that it's maybe a little bit
- 7:23more than just
- 7:24declarative
- 7:26infrastructure as code
- 7:27is Bicep is a
- 7:30domain specific language or a DSL.
- 7:35So when we say domain specific language,
- 7:38there are other languages out there. So let's
- 7:41think like programming languages
- 7:43like
- 7:44dot net, Python,
- 7:45Java,
- 7:46Go, things like that.
- 7:48And those can all be used across a
- 7:51bunch of domains. They're more generic. Java runs
- 7:54on multiple platforms.
- 7:56It's something that it's meant to pick up
- 7:58and you put your logic into it and
- 7:59you go from there. So you could absolutely,
- 8:02say, pick up, like, the Java management playing
- 8:04SDKs
- 8:05that
- 8:06Microsoft and Azure provide,
- 8:09and you could use those management playing SDKs
- 8:11to provision your resources.
- 8:13Or you can use something like Bicep, which
- 8:15is this domain specific language. So it means
- 8:17it's really
- 8:18a programming language, and it's designed for a
- 8:22specific application
- 8:24or a problem domain. And in this case,
- 8:26the application slash problem domain
- 8:29is Azure Resource Manager.
- 8:31And
- 8:32being able to manipulate Azure Resource Manager and
- 8:35ultimately, like, leverage the underlying REST APIs that
- 8:38power ARM
- 8:40or Azure Resource Manager using
- 8:42Bicep.
- 8:43So it goes a little bit beyond maybe
- 8:45ARM templates in that it is
- 8:48a little bit more,
- 8:50it it it is a little bit more
- 8:52programmer y at the end of the day.
- 8:53And I think you find that out pretty
- 8:55quick, especially when you start using
- 8:58some kinda common things in bicep, say, a
- 9:01for loop in your bicep template
- 9:04and consuming custom iterators,
- 9:07moving into more formal, like, objects,
- 9:11and
- 9:12having hash maps available to you. There's just
- 9:14all sorts of stuff in there that wasn't
- 9:17available to you in Arm.
- 9:20Now the interesting thing here is bicep's a
- 9:23little bit of a programming language, but when
- 9:25you go to run bicep and you go
- 9:27to run a bicep template,
- 9:29it turns out that your
- 9:31bicep template
- 9:33or your bicep
- 9:34files, like your dot bicep file, your bicep
- 9:37modules, what whatever it happens to be,
- 9:39is actually converted into a call to Arm
- 9:43and ultimately submitted as an Arm deployment.
- 9:46So let's say you create a bicep file
- 9:48where you want to
- 9:50create a virtual machine, and a virtual machine
- 9:52needs its VM, it needs a VNET, it
- 9:55needs a NIC, all those kinds of things.
- 9:57So you'll author that in Bicep, which is
- 10:00its own specific language, but then you'll maybe
- 10:03go off to, like, the CLI or PowerShell,
- 10:05and you'll say, hey. Let me do a
- 10:06new deployment.
- 10:08And just like you would pass in an
- 10:09ARM file, like that dot JSON file from
- 10:12an ARM template deployment, you would just pop
- 10:14pass in your dot bicep file and under
- 10:17the hood, that gets translated
- 10:19into
- 10:20an ARM template or a set of ARM
- 10:22templates and submitted to
- 10:25the deployment engine and then spun up from
- 10:27there.
- 10:28And then you can leverage all the same
- 10:30things as ARM templates do, including things like
- 10:32outputs on the outside
- 10:34or outputs from your ARM templates, things like
- 10:37that.
- 10:38It's
- 10:39it takes the
- 10:41I would say it takes the goodness of
- 10:42Arm and it uplevels it into just this
- 10:45very specific language, like less generic JSON,
- 10:48and being far more opinionated about here's the
- 10:51things that we're gonna let you do with
- 10:53a domain specific language
- 10:55that is focused 100%
- 10:57on Azure Resource Manager as a domain. Yes.
- 11:01And I think that's where it kinda I
- 11:02would say it sits in the middle because
- 11:05naturally someone will probably ask Terraform, where Terraform,
- 11:08you probably wouldn't consider it one of those
- 11:10domain specific languages. Terraform
- 11:12has modules for Azure, modules for
- 11:15AWS,
- 11:16so I think for GCP. I'm not a
- 11:18100% sure. Where Bicep kinda sits in the
- 11:20middle of between maybe ARM templates and Terraform
- 11:23of it's close to Terraform, but it only
- 11:26works on Azure. I think one thing to
- 11:27think about too, and I'm curious
- 11:30on your thoughts, and we've hinted at it
- 11:32some is we already have ARM templates. We
- 11:34already have all the JSON.
- 11:36What are those advantages? If people are looking
- 11:40to, we're gonna be in Azure, we wanna
- 11:42use infrastructure as code, we've been using JSON
- 11:45templates, or
- 11:46why would we go learn Bicep if we
- 11:49already know JSON templates?
- 11:50Why why use Bicep versus
- 11:53just JSON or ARM deployments or, for that
- 11:56matter,
- 11:57I know why you'd use it over the
- 11:59GUI, but over ARM templates. It's far more
- 12:01expressive, I I think is the way I
- 12:04would frame it. So
- 12:06JSON
- 12:07as a language for capturing configuration
- 12:12is
- 12:13pretty inflexible.
- 12:15It's not specific to ARM. JSON's just a
- 12:18thing that's out there, JavaScript object notation.
- 12:20So there's lots of solutions that leverage JSON,
- 12:23and you can certainly have, like, rules for
- 12:25JSON. K. It must pass
- 12:27this set of linting rules, things like that,
- 12:29commas in the right places, closing strings, all
- 12:33the all that kind of stuff. But it's
- 12:34still just JSON at the end of the
- 12:36day. Like, there's nothing specific in there that
- 12:38says, oh, this is ARM specific or Azure
- 12:41Resource Manager specific, and that's where Bicep's gonna
- 12:44come in. So it's gonna be more expressive
- 12:46in that it is ARM specific, and it's
- 12:48gonna be very geared and opinionated
- 12:50towards just doing ARM over just straight JSON
- 12:54and having to figure out the linter and
- 12:56and things that you're gonna pick along the
- 12:58way for it. And the other is
- 13:00it really is like a little miniature programming
- 13:03language.
- 13:04Again, things like
- 13:05native for loops
- 13:07inside
- 13:08of your
- 13:10bicep
- 13:11your bicep templates or your modules.
- 13:14You can have custom user defined data types,
- 13:18which
- 13:19you can actually have, like, in a Bicep
- 13:21file, you can have a type that's an
- 13:23object, and you can have an object with,
- 13:25like, dot properties on it. So let me
- 13:27say so so maybe for a virtual machine,
- 13:30when I spin up a virtual machine, it
- 13:31has a SKU or a VM family, it
- 13:33has a name, things like that. So I
- 13:36would I could absolutely define all those as
- 13:38individual parameters or things like that, or I
- 13:40could just group them all into a single
- 13:41object. I could have, like, my VM, and
- 13:44then inside that object, I could have a
- 13:45property called name that's of type string. I
- 13:48could have a property of SKU of type
- 13:50string. I could have a property of number
- 13:52of nicks
- 13:53of type integer, things like that, and then
- 13:56I could even set default values around those.
- 13:58And then I just consume that object and
- 14:00pass that object around
- 14:02within
- 14:03my bicep modules
- 14:05and and templates and things like that along
- 14:07the way.
- 14:08I think that's super powerful for you to
- 14:10have. There's a ton of
- 14:12built in functions around things.
- 14:16So there's a bunch of array functions.
- 14:19There's way more for dates and times
- 14:23and kinda date and time formatting.
- 14:26There are specific functions that you have available
- 14:30around
- 14:30numbers. So, say, like, casting something as an
- 14:33integer, being able to do, min and max.
- 14:36Say you have an array of items and
- 14:37you wanna access an array in in items,
- 14:40you can do things like dot first or
- 14:42dot last in in a collection as you
- 14:45pass them through.
- 14:46There's tons and tons of string functions. There's
- 14:5030 plus string functions out there. So things
- 14:53you're used to maybe from Armland, say unique
- 14:55string, like, unique string still exists over here,
- 14:58but it's actually way more powerful because it
- 15:00supports, like, parameters
- 15:02for
- 15:03seeding the hash and for length of the
- 15:05hash. You've got GUIDs. You've got string padding,
- 15:09string trimming, like trim left, trim right to
- 15:12upper to lower.
- 15:14You can pull out like, there there's functions
- 15:16for manipulating
- 15:18URLs. Say you're working with, I don't know,
- 15:20a storage account. 1 of the outputs for
- 15:22creating the storage account is what the primary
- 15:23endpoint is. Say you wanted to do something
- 15:26with that URI as it comes back, there
- 15:28there's functions available for that.
- 15:31Lambda functions,
- 15:32file functions.
- 15:34Let's see. There's functions specific to parameters
- 15:38within your templates that you create in Bicep.
- 15:42So I don't know. Like, one of the
- 15:43fun things you can do in a Bicep
- 15:46file that you can certainly do
- 15:48in, like, a Bash script or a PowerShell
- 15:50script and pass it in as a parameter
- 15:53in an ARM template, but you gotta go
- 15:54through that extra machination,
- 15:56is
- 15:57Bicep has the ability to do things like
- 15:59read environment variables.
- 16:00That's cool. Right? Like, just have
- 16:04environment variables spun up within your shell, and
- 16:07you can actually pull those things in. It
- 16:10has native support for pulling secrets
- 16:12out of things like Key Vault. So if
- 16:15you're doing the deployment
- 16:17as an entity
- 16:18or a user identity that has the ability
- 16:20to say talk to a Key Vault, there's
- 16:22a get secret function where you can reach
- 16:24out to a specific
- 16:25subscription resource group Key Vault and pull a
- 16:29particular secret
- 16:30and even pull a particular secret by its
- 16:33version, things like that. So it it's
- 16:36way more powerful at the end of the
- 16:37day. Like, it's just more expressive.
- 16:41Yes. A 100%. And that's,
- 16:43again, JSON, they're pretty
- 16:45static. You can't there's you can't come close
- 16:47to doing all that type of stuff,
- 16:49just writing ARM files to JSON.
- 16:52So I think now that we've gotten that
- 16:53out of the way, is maybe getting started
- 16:56with it. If you wanna set up a
- 16:58bicep environment,
- 17:00and
- 17:01do you wanna jump there? We've got best
- 17:03practices
- 17:04with bicep, which we go into next. Install
- 17:07bicep tools. We should probably start with tools
- 17:10and installing tools. So this is a little
- 17:12bit like a programming language again. So just
- 17:14if you were going to
- 17:16write dot net code on your,
- 17:19local PC, you're gonna wanna install the the
- 17:22dot net framework, and you might wanna install
- 17:25some helper extensions.
- 17:26You might wanna have, like, Visual Studio Code,
- 17:29things like that all stood up and ready
- 17:30to go.
- 17:31So I think Bicep Tools
- 17:33is
- 17:34a
- 17:35great place to start. So
- 17:37first, you're gonna want some things that you
- 17:39probably already have. And those things are, say,
- 17:43like the Azure CLI and Azure PowerShell.
- 17:45That's because, ultimately, at the end of the
- 17:47day, Bicep is
- 17:49about manipulating your infrastructure or your resources within
- 17:52Azure.
- 17:53Again, it all gets converted into ARM templates
- 17:55and ARM deployments when you do those submissions.
- 17:58So the easiest way one of the easiest
- 17:59ways to do those submissions in that testing
- 18:02is from the command line with things like
- 18:04PowerShell
- 18:05and CLI where you're just going to submit
- 18:08a new deployment,
- 18:09but rather
- 18:11than submitting that deployment against a dot JSON
- 18:14file and an ARM template,
- 18:17you would just do a bicep file. And
- 18:18it's all the same commandlets and same sets
- 18:21of
- 18:22command line parameters that you've been using along
- 18:24the way. So once you've got PowerShell CLI
- 18:27installed, you're all ready to deploy Bicep templates.
- 18:30So the next step is, let me go
- 18:32and create a Bicep template. You're gonna want
- 18:34some tooling to help you along the way
- 18:36to do that. Like,
- 18:37it's just a text file at the end
- 18:39of the day. Like, it's a dot bicep
- 18:41file is the extension on it. That being
- 18:43said, you're gonna want some things like maybe
- 18:45a linter to help you, something that can
- 18:47help you auto format.
- 18:49Helps you have autocomplete
- 18:51and IntelliSense
- 18:53as you're authoring these files.
- 18:55The easiest way and and the way that
- 18:56I go about it personally
- 18:58is just using Visual Studio Code, and Visual
- 19:02Studio Code has a native bicep extension. It's
- 19:04available in the marketplace.
- 19:06It's authored and and maintained
- 19:09and made available from Microsoft.
- 19:12The other option that's available to you is
- 19:14to
- 19:15go out
- 19:17and leverage Visual Studio.
- 19:20So that's an option. If you're just a
- 19:21Visual Studio developer,
- 19:23totally doable. You can go and make that
- 19:25happen.
- 19:26There's also a formal bicep extension for for
- 19:30Visual Studio full on. I don't know that
- 19:32you need Visual Studio full on. Like, Versus
- 19:34Code is free.
- 19:35The extension that's there is super powerful.
- 19:38You have native inline terminal support in Versus
- 19:41Code. Like, I'm just used to it from
- 19:43working in it over the years,
- 19:44and that tends to be the place that
- 19:46I go. Like, there's no other special tool
- 19:49or thing like that that you have
- 19:52to go out and grab. There's no, oh,
- 19:54grab the bicep development studio or anything like
- 19:57that. Just go grab Versus Code. You probably
- 19:59already have Versus Code. You probably already have
- 20:01PowerShell. There's CLI installed already if you're working
- 20:04with Azure. So really, the only thing you
- 20:06need is the Bicep extension,
- 20:07and from there, you're off to the races,
- 20:11And you can go do what you need
- 20:12to do. I saw the one for Visual
- 20:14Studio, and it made me laugh because I
- 20:16was like, I don't know. I think the
- 20:18last time I opened Visual Studio was writing
- 20:20SharePoint 2013
- 20:21extensions and stuff.
- 20:23I'm with you. I don't know why you
- 20:24would use Visual Studio Code for Bicep, but
- 20:26if you really like visuals or why do
- 20:28you use Visual Studio? If you really like
- 20:31it, it's there. But I'm with you. Visual
- 20:33Studio Code for all these
- 20:35super simple,
- 20:36lightweight, works the same,
- 20:38more or less,
- 20:40on macOS, Windows,
- 20:41all of those.
- 20:42And then that Bicep extension. Yeah. I was
- 20:45just looking So once you've got all that
- 20:47installed, I was gonna say that once you
- 20:49got that installed, your next step is
- 20:52probably go get hands on with a bicep
- 20:54file. I know some folks like to watch
- 20:57videos. You can absolutely go out to YouTube
- 20:59and
- 21:00take a look around for these or if
- 21:01you have a subscription to LinkedIn Learning, things
- 21:03like that. There's formal classes out there, but
- 21:06one of your next steps might be to
- 21:07just go out and
- 21:09spin up a template in Versus codes. There's
- 21:11there's a pretty good quick start
- 21:13on Microsoft Learn
- 21:15where it just walks you through creating kind
- 21:18of your first
- 21:20bicep file
- 21:21in Versus Code,
- 21:23and that'll walk you down a path of
- 21:26working with resources,
- 21:29going through the general machinations,
- 21:31and things like that.
- 21:33And then once you've got a handle on
- 21:35what a default set or or kind of
- 21:38a minimal bicep file is, then you can
- 21:40start thinking about, like, optimizations
- 21:42or what are some new good next steps
- 21:44for me to take, things like that. Is
- 21:46there a good get I'll repo. I was
- 21:47looking we threw together this Azure quick start
- 21:50templates, but this is also templates that looks
- 21:53like for
- 21:55everything, ARM templates. I was trying to look
- 21:56through if there's a spot where they consolidated
- 21:59everything in here
- 22:01under
- 22:02some Bicep files. Is this one really all
- 22:06arm templates? No. It's arm and bicep all
- 22:08mixed together. That's not helpful.
- 22:12If you go in and it it it
- 22:14is helpful though because, again, bicep and arm
- 22:16are You can see how they relate, how
- 22:19one leads to the other. Oh, here they
- 22:20are. 6 to 1, half half dozen of
- 22:22the other. Right? So as you're going through
- 22:25the quick starts repo, one of the things
- 22:26you'll see is that there's dot bicep files
- 22:29alongside the dot JSON files
- 22:32that existed out there previously
- 22:35from the
- 22:36from the ARM templates that were available for
- 22:38you.
- 22:39I know where you say, hey, maybe I
- 22:41think that's not helpful, but I would make
- 22:42the argument that it's actually super helpful because
- 22:44if I'm already familiar with ARM templates and
- 22:47the construct of those JSON files,
- 22:50now I can see side by side
- 22:52and do that mental
- 22:54mental map and translation in there. I can
- 22:56see that. And they are sorted by resources.
- 22:58So if you go out to this GitHub
- 23:00repo and you start looking through, like, they
- 23:03have a bunch of other stuff around
- 23:05demos and modules, but under the quick starts
- 23:08then it's broken down by things like
- 23:10app services
- 23:12on ACR.
- 23:13You have things in here for
- 23:15app services with HTTP
- 23:18scaling rules,
- 23:19you have automation
- 23:21accounts
- 23:22and configuration,
- 23:24all the things Databricks,
- 23:26Devices,
- 23:27HD Insights, Key Vault. And then once you
- 23:30get down there, they have different ones. Like
- 23:33under Key Vault, there's,
- 23:35what, maybe 10 different 10, 11 different samples
- 23:38of Key Vaults with private endpoints, Key Vaults
- 23:40with managed identity role assignment,
- 23:43just creating Key Vaults. And that's
- 23:45where under certain ones, not all of them,
- 23:47you will find Not all of them have
- 23:49it. Yes. Not all of them have it,
- 23:51but under certain ones, you will have, like
- 23:53you said, those JSON files and those dot
- 23:56bicep files that you can
- 23:58open up, look at, compare,
- 24:00figure out how to translate from one to
- 24:02the other. You've got all those out there.
- 24:04You can also
- 24:06export
- 24:07your
- 24:08existing resources.
- 24:09So for a long time, you've been able
- 24:11to
- 24:12export, like, an ARM template of your existing
- 24:14resources.
- 24:15I think it's a little bit of a
- 24:16misnomer that we tell customers that, like, oh,
- 24:19you can export it, but you can't actually
- 24:21run that template and then have it spin
- 24:23up the same resource again. Yeah. That being
- 24:25said, like, you at least get it as,
- 24:27like, a manifestation
- 24:28or an example
- 24:29of the things that are sitting out there.
- 24:32You can export to ARM,
- 24:35to an ARM template, export to Bicep. They
- 24:37recently added the ability to export to Terraform
- 24:40as well. So you mentioned Terraform earlier.
- 24:44Terraform is all built around HCL.
- 24:46HCL is a scripting language.
- 24:48So Terraform is
- 24:51also a domain specific language. Right? It's another
- 24:54set of these things where you're doing maybe
- 24:56a little bit more programming than just generic
- 25:00generic JSON
- 25:02kind of thing and JSON validation,
- 25:04which also shows, hey, Microsoft's moving in the
- 25:07direction that some of these other things have
- 25:08been going for a while now, like HashiCorp
- 25:11with TerraForm. This is one thing. I have
- 25:12not written much bicep. I will be honest.
- 25:15It is it's on my list. Remember that
- 25:17list? I haven't talked about my list in
- 25:19a while.
- 25:21Yeah. Yeah. It it is a thing that's
- 25:23out there. Oh, one other option for you
- 25:25just while we're talking about, hey, maybe getting
- 25:27hands on
- 25:28and finding examples and things like that is
- 25:31it's also possible
- 25:33to
- 25:35so when you execute a bicep
- 25:38script
- 25:39and you go ahead and actually do that
- 25:41deployment again, it's converted into an ARM call
- 25:43on the back end.
- 25:44So beyond going from, like, a bicep file
- 25:47to an ARM template, you can also go
- 25:49the other way, and you can decompile
- 25:51an ARM template
- 25:52and turn that
- 25:54into
- 25:55a bicep file as well. So maybe if
- 25:57you have already an investment, like, you're very
- 25:59familiar with arm templates and you're like, I
- 26:01don't know. Just put me on the path
- 26:02where I can start to figure out how
- 26:04to translate my existing stuff. You can go
- 26:06down that path as well and convert back
- 26:09the other way. Got it. The other thing
- 26:11I would say getting started, if you are
- 26:14new to this, is there is also some
- 26:16learn modules for BICEP 2. Like we talked
- 26:19about, you can just go read the learn
- 26:20documentation,
- 26:21but there is
- 26:23a learn module
- 26:25for walking through
- 26:27how
- 26:28you can start using Bicep, covering fundamentals.
- 26:31There's like the fundamentals,
- 26:32intermediate,
- 26:33advanced,
- 26:34going through different
- 26:35deployments.
- 26:37Looks like there is some for
- 26:39there's probably some in here for authoring Bicep
- 26:42files.
- 26:43But if you do want a little bit
- 26:44more of a, let's say, guided approach to
- 26:47walking through
- 26:49learning it, writing them, using them in deployment,
- 26:52pipelines as in here, using it in deployment
- 26:55stacks. There is also this learn module for
- 26:59bicep. There are tons and tons of learn
- 27:02modules out there.
- 27:04One recommendation
- 27:05that I would have for folks, and I
- 27:08keep going
- 27:09back to
- 27:11this one, is there's a specific learn module
- 27:15out there.
- 27:16Let me pull up a link to it.
- 27:18So it's called structure
- 27:19your bicep code for collaboration,
- 27:23and I think this is a really good
- 27:25one for a couple of reasons. One is
- 27:27it starts to walk you down the optimization
- 27:29path
- 27:30from the start. So it gives you this
- 27:34big long bicep file, which is more than
- 27:36just deploy a storage account, which is one
- 27:38of my annoyance when you go out and
- 27:40start with the quick starts and things. They're
- 27:41usually like deploy a storage account to play
- 27:43this single instance thing, like, yeah, I get
- 27:46single instance, but you'll probably want, a little
- 27:48bit more than that. So the the very
- 27:50first thing that does is it goes out
- 27:53and it gives you
- 27:55a getting started bicep template,
- 27:57which totally works as is. It's just not
- 28:00optimized.
- 28:01It's just not doing all the things that
- 28:03you might want it to do.
- 28:06It's got, like, bad names for parameters.
- 28:09And so that learn module walks you through
- 28:11things like how to think about naming your
- 28:14parameters, which the the guidance for naming your
- 28:17parameters in a bicep file, by the way,
- 28:19doesn't really differ from the guidance of how
- 28:21you should be naming your parameters in an
- 28:22ARM template, but I think it's a good
- 28:24reinforcement
- 28:25because
- 28:26I'm I know I'm guilty of this all
- 28:27the time where I go out and I
- 28:29create something and I just go, like, the
- 28:30easy button. I'm like, oh, I need a
- 28:32name.
- 28:33Var name equals blah blah blah. But it
- 28:35turns out that name was for a specific
- 28:37resource. It was like a name for a
- 28:38virtual machine. So what I really should have
- 28:41done was name that variable, like, var
- 28:44my
- 28:45web virtual machine, var my middle layer, my
- 28:49API layer virtual machine. Like, you should be
- 28:51far more descriptive, use camel case,
- 28:53all those kinds of things. Make sure that
- 28:56your parameters
- 28:57are typed.
- 28:58So, integers are integers, strings are strings, objects
- 29:01are objects. Of course, this is like back
- 29:04to programming language thing. This helps us leverage
- 29:07and use all of those later on.
- 29:10It also walks you down the path of
- 29:13how to
- 29:14think about structuring
- 29:16your bicep files
- 29:17because
- 29:18ARM files are very specific where the parameters
- 29:21are at the top, resources are in the
- 29:23middle, and outputs are always at the bottom.
- 29:25Right? It's just gotta follow that flow,
- 29:28to be able to lint and things like
- 29:29that's not the case with a bicep file.
- 29:31You can have a parameter here, a resource
- 29:33here. You can have an output here. You
- 29:35can have this other thing. You can have
- 29:36a function next. Like, you can just go
- 29:39wild. I think structure that thing however you
- 29:41want, but that might not be the most
- 29:43readable thing for the next person. It might
- 29:45not be the best way to leave your
- 29:48campground
- 29:49in a in a good place for the
- 29:50next camper when they come through. And you
- 29:52don't want folks having to clean up after
- 29:54you. So it it it could that module
- 29:56in particular gives you a sense of what
- 29:59some of those things are that you would
- 30:01want to
- 30:03think about along the way. And, ultimately, what
- 30:05it does is it walks you down a
- 30:07couple steps. Let's improve your parameters. Let's improve
- 30:09your parameter names. Let's make sure we put
- 30:11comments in. Oh, do you understand the difference
- 30:14between inline comments versus structured comments versus multiline
- 30:18comments?
- 30:19All those kinds of things. Are your
- 30:22are your templates
- 30:23annotated
- 30:24correctly? So
- 30:26beyond
- 30:27your things like having comments,
- 30:30have you put descriptions on your parameters? So
- 30:33in case you're asked for, like, a parameter
- 30:35input when you're running a deployment from the
- 30:37command line, have you thought about how you
- 30:39commonly structure things like resource tags and governance
- 30:43constructs?
- 30:44That's all in there. And, ultimately, it walks
- 30:46you down this path of, hey, let's optimize
- 30:48and refactor your bicep file. So it gives
- 30:51you an a and b, camera 1, camera
- 30:542 kind of thing, and it gives you
- 30:56the flexibility and the freedom to figure it
- 30:58out your
- 30:59your yourself along the way.
- 31:02I think that's super helpful
- 31:04and
- 31:05definitely works towards
- 31:07improving just readability of bicep files and keeps
- 31:10you on a common path as the way,
- 31:12like, the creators of that
- 31:15domain language
- 31:16intended,
- 31:17walks you through rationalization
- 31:19for ordering elements.
- 31:21I think you also
- 31:22work with
- 31:24collections
- 31:25in that module.
- 31:27So collections
- 31:28allow you to have, like, multi propertied
- 31:32objects
- 31:33that you can consume in an easier way.
- 31:35One of the examples that I can think
- 31:37of again is, like, virtual machines. So virtual
- 31:39machines have
- 31:41a SKU, like, hey, I'm deploying a b
- 31:43one VM over here, but then you also
- 31:45have things like number of instances of a
- 31:47VM that you want to deploy, and you
- 31:49might want to make that a parameter and
- 31:51dynamic within
- 31:52within your function. So rather than having a
- 31:54parameter of
- 31:56my VM one name dot SKU and my
- 31:59v one my VM
- 32:01one dot count,
- 32:03maybe you have more like a environment
- 32:06parameter or you have some other parameter that
- 32:08says, oh,
- 32:09when parameter is set to prod,
- 32:12just deploy
- 32:13d series VMs with this many instances. When
- 32:16it's set to dev, deploy b series
- 32:19with this many instances, or deploy this set
- 32:21of tags or these things over here. So
- 32:23it it walks you through all of those
- 32:26constructs as well
- 32:28in in, I think, a pretty clear manner.
- 32:30And like I said, that's when I I
- 32:32tend to find myself, like, going back to
- 32:34just
- 32:36the main optimization
- 32:37article
- 32:38that Microsoft
- 32:40has out there. So they have a best
- 32:42practices
- 32:43for bicep article.
- 32:45Between that one and then just revisiting that
- 32:47learn module occasionally, where I can, again, a
- 32:49b the starting and the ending template
- 32:51or the starting and ending bicep file, then
- 32:54that that generally gives me a good sense
- 32:56and enough to, like, oh, yeah, give my
- 32:58brain a kick, and let me remember where
- 33:00I wanted to be with that particular thing.
- 33:02Sounds good. I really should go spend some
- 33:04more time with biceps, Scott. Even though it
- 33:06is 4 o'clock and Friday, I still have
- 33:083 more meetings today. Yuck.
- 33:11So we should call it a day, get
- 33:14ready for Ignite.
- 33:15We will probably we'll probably try to get
- 33:17some interviews, have some news,
- 33:19talk about some of the Ignite stuff here
- 33:20in the next couple of episodes. Yeah. I
- 33:23am
- 33:24looking forward to it. Got my plane tickets
- 33:27booked and everything. I'm all set. Perfect. We
- 33:29will see you at Ignite, Scott, and hopefully,
- 33:31we will see a few of, your listeners
- 33:34at Ignite as well here in a couple
- 33:35weeks. But for now, enjoy your weekend, and
- 33:38we will talk to you again later. Great.
- 33:40Thanks, Ben.
- 33:42If you enjoyed the podcast, go leave us
- 33:45a 5 star rating in iTunes. It helps
- 33:47to get the word out so more IT
- 33:49pros can learn about Office 365 and Azure.
- 33:52If you have any questions you want us
- 33:54to address on the show or feedback about
- 33:56the show, feel free to reach out via
- 33:58our website, Twitter, or Facebook.
- 34:01Thanks again for listening, and have a great
- 34:03day.