Introducing a Primer on Powershell 7
The AZ-140 is a whopper of an exam, and to add to the challenge, it explicitly calls out deployments from PowerShell, AZ CLI, and ARM templates. All of these can be challenging on their own, especially if you are not familiar with the tools. This set of videos will focus on PowerShell first.
Install Powershell and Prep VS Code
In order to work with Powershell, you have to, well, have Powershell. Even Windows desktops still need to have the latest and greatest version installed, Powershell 7. Here is a link to the Github release downloads. And here is a link to the VS Code installer.
Knowledge Check
Which extensions should you install into VS Code?
Understand Cmdlets
Let's take a moment to talk about what a Cmdlet is. Cmdlets are the foundation of Powershell, and understanding their basic structure will be the first step to working with it.
Knowledge Check
What is the structure of a cmdlet?
Use Parameters with Cmdlets
Cmdlets are powerful, but their power really comes from parameters. Parameters are additional pieces of data that a Cmdlet will need to carry out its task. Think of them sort of like filters, or like options in a command-line tool.
Knowledge Check
What cmdlet is used to see all of the available parameters in a cmdlet?
Store Data and Objects with Variables
One of the things about object oriented programming that makes it so powerful is that you can store the data, evaluate the data, and then make decisions on what to do next. The first part of that is storing the data, and that is frequently done with variables.
Knowledge Check
What symbol is used to denote a variable in Powershell?
Evaluate Objects and the Pipeline
Now is where we step our skills up a lot. It's time to really understand what the "object" is in Object Oriented Programming. This really comes down to understanding what a Class is and how Powershell uses them.
Knowledge Check
What command will show you valid input or output objects for a Cmdlet?
Login to Azure and Set a Subscription
Now we'll put it all together in this video, while also prepping for working with Azure. We'll get logged in to Azure and also set our default subscription to use. We'll ALSO learn how to use the Where-Object cmdlet!
Knowledge Check
Which cmdlet is used to login to Azure from the shell?
CHALLENGE
Explore the Subscription object that was a result of the Get-AzSubscription cmdlet. What properties does it have? Use the video below to check your results.
Knowledge Check
Will you use Powershell scripts in your environment?
This interactive assessment is available in the full learning experience.
View Transcript
Introducing a Primer on Powershell 7
0:00Welcome to the content on getting up to speed on PowerShell and welcome to the
0:05AZ-140 certification exam focusing in on virtual desktop infrastructure. Now
0:11you
0:12may be stopping and thinking yourself you may have actually spied on this
0:16playlist and the content that's coming up and you see that immediately out of
0:20the gate we're talking about PowerShell we're gonna talk about Azure CLI we're
0:25gonna talk about ARM templates with JSON and bicep and none of that has
0:29anything to do with virtual desktop infrastructure or does it the AZ-140
0:35certification exam specifically has a bullet point on deploying virtual desktop
0:40infrastructure with PowerShell with the AZ CLI with JSON ARM templates and with
0:47bicep ARM templates and if you are not familiar with working with those types
0:52of things up front you're gonna have a bad time when it comes to taking the
0:57certification exam I personally have not taken a Microsoft exam yet that doesn
1:02't
1:02have PowerShell on it but beyond that even if we take the certification exam
1:07out of the picture for a second I personally feel the PowerShell is one of
1:12the most powerful and important things that any Microsoft developer or
1:18Microsoft
1:19systems administrator cloud architect network engineer everyone should know
1:24fundamental PowerShell it is extremely powerful hopefully by the end of this
1:29set of videos you will feel the exact same way what we're going to do is we're
1:32going to introduce the fundamentals of PowerShell ultimately the thing that I
1:37want you to take away from this is to be able to look at a PowerShell script
1:42that you've never seen before and be able to tell exactly what's happening in
1:46it
1:47if you can do that you are set up for much better success when it comes time to
1:52take your certification exam so without further ado let's get primed on
1:56PowerShell let's go
Install Powershell and Prep VS Code
0:00There's a few things going into this content that you might be thinking to
0:04yourself.
0:04You might be thinking to yourself, "Hey, yourself, I don't think I really need
0:08to learn PowerShell
0:10because it's something that I haven't used yet in my career.
0:14I've been fine on just the standard command line or I've been doing fine on
0:19just the
0:20GUI.
0:21I'm going to tell you you're missing out because PowerShell really is a
0:26powerful shell.
0:27PowerShell is in fact an object oriented programming language.
0:34And with that comes a lot of well flexibility and power that you can use with
0:40it.
0:41Then you also might be thinking to yourself, "Well, why do you have on the
0:44screen these
0:45documents on how to install PowerShell?
0:48Don't I already have PowerShell out of the box if I buy, say, a Windows
0:53computer?"
0:54Sort of.
0:55Now Windows computers, PowerShell out of the box, ships with something known as
1:00Windows
1:01PowerShell.
1:02And that is a little bit different from what we now know and work with, which
1:06is the open
1:08source version of PowerShell, known as PowerShell version 7.
1:14Sometimes you see PowerShell abbreviated PWSH, which is why I'm writing it on
1:19the screen.
1:19In fact, that's actually a command that you have to type on some operating
1:23systems to
1:24launch PowerShell.
1:25See, you're already learning something.
1:28PowerShell version 7 again does not ship with any operating system out of the
1:32box.
1:32And this is why it's really important to talk about PowerShell 7.
1:36It's not just that it's the latest and greatest.
1:39It's that what we're here primarily to talk about is Azure.
1:44We're going to be working with Azure Virtual Desktop Infrastructure.
1:48And the exam blueprint calls for using PowerShell to deploy pieces of Virtual
1:53Desktop
1:53Infrastructure.
1:54Well, when it comes to typing PowerShell commands to work directly with Azure,
2:00that is only currently
2:02supported by PowerShell version 7.
2:05So if you have any intention of working with Azure via PowerShell, you must, I
2:10repeat, must
2:11have PowerShell version 7, which requires you to go out and get it.
2:15Now there's a few different ways that you can go out and get it.
2:18I'm going to show you some of the easier ways and some of the more complicated
2:21ways.
2:22In my opinion, one of the easiest ways to go out and get it is to go straight
2:26to the
2:26source of PowerShell.
2:28It is github.com/powershell/powershell.
2:33So if I just click on it right here, this is where it takes github.com/power
2:37shell/powershell.
2:38This is proving yet again that this is open source.
2:42Anyone who has to know how or will power can continue to help work with
2:49PowerShell.
2:50It is open source in the sense that anyone can fork this repository and make
2:54changes
2:55or fixes or new feature updates to it and propose that Microsoft add those in
3:00to a new
3:00release or build.
3:03Now when you're ready just to come along and download it over here on the right
3:05hand
3:06side of the screen, you can see the releases section where my mouse is
3:10currently.
3:11Go ahead and click releases and it takes you in.
3:13The latest release is up here on top.
3:17Currently it's 7.4.0.
3:19You can see this was released two weeks ago.
3:21And when you want to download and install it, you can scroll on down right here
3:26to the assets
3:27section.
3:28Now do note there are 25 total assets.
3:31That's not what you see right here on the screen.
3:33To see them all, you click show all 25 assets.
3:36Now you can see the down the installers that you need for your particular
3:41environment.
3:42So you could use Mac OS with ARM based architecture or Intel based architecture
3:48, Windows for 64
3:49bit or 32 bit.
3:52And then of course Linux based installations again also based on Intel
3:55architecture or
3:56ARM based architecture.
3:58Now some of these might be a little tricky.
4:00You might not be on an operating system where you can navigate to a red browser
4:04downloaded
4:05and install it.
4:06You might be on something like Ubuntu server or Windows subsystem for Linux.
4:10Check this out.
4:11This is why I did bring up that documentation at the end of the day to go out
4:14and get Windows
4:15PowerShell or it was so I said Windows PowerShell PowerShell PowerShell version
4:18seven.
4:20Open up the document that is relevant to you.
4:23I'll bring up PowerShell on Windows Mac OS and Ubuntu.
4:27Those are going to be the three most popular ones.
4:29And each of them does have a unique way of going out and getting them.
4:33The recommended method if you're on Windows is to use when get.
4:37Fire up your command line and do when get search Microsoft dot PowerShell.
4:42You'll see both the standard support as well as the preview version of
4:47PowerShell.
4:48And then you just choose which one you want to install by typing in the command
4:52with the
4:53given ID that you see above right there.
4:55Now of course like I said above you do have the ability to download the
4:58packages themselves
5:00like the MSI's.
5:01That's a nice and easy way to do it.
5:03So if you don't want to use the package manager for whatever reason you could
5:06just do the installer
5:07that way.
5:08Again if you're working with something like Windows Server Core where you're
5:12not going
5:13to have a GUI to go install the packages or download from a browser you can use
5:17when
5:18get to go get it.
5:19Mac OS again a pretty straightforward installation.
5:22You can just use brew.
5:24The only catch of course is that you do have to add the repository to the brew
5:30environment.
5:31If you don't have brew already that's what this command is showing you how to
5:35go out
5:36and do.
5:37And then using the brew command you can again once more install it.
5:40Now like I said above or before you can then type P W S H to launch PowerShell.
5:46So as you could probably tell from right now I am currently working on a Mac OS
5:52machine.
5:52This is actually using a M2 MacBook Pro so it is Apple Silicon.
5:57If I type P W S H boom you can see I bring up the PowerShell prompt and it's
6:01denoted right
6:02there with that PS.
6:04I'll go ahead and close it.
6:06It will warn you that you're terminating the PowerShell process that's
6:10perfectly fine.
6:11Also notice that it's very easy to update and upgrade your version of
6:15PowerShell using
6:15brew with just a couple simple commands.
6:18Lastly on Ubuntu let's scroll down and take a look at how to use this.
6:23Not terribly surprising we're going to be using the app repositories right here
6:27making
6:27sure that we have the prerequisites to install.
6:30So we get the prerequisite packages.
6:32We then get the repository keys and register the repository.
6:37Then it's just as simple as a pseudo app install PowerShell.
6:41And again using the P W S H command launches PowerShell.
6:46Now also the exam blueprint calls for us to work with another type of shell
6:51that you
6:52might be familiar with if you've ever worked with Azure before.
6:55And that is the Azure CLI.
6:57Let's go ahead and search for the Azure CLI and make while we're talking about
7:01installing
7:01shells into our environment make sure you get PowerShell version seven then
7:06make sure
7:06you get the Azure CLI as well.
7:08So let's go ahead and take a look at this.
7:10Bringing up this documentation feel free to click one of the links above to
7:14bring it here.
7:15You've got the same drill here.
7:16This is again, open source so it works with Windows, Mac OS or Linux and
7:23importantly both
7:25the Azure CLI and PowerShell are built on top of the dot net framework.
7:31Now you might be thinking yourself what's really the difference between the
7:34Azure CLI
7:35and PowerShell.
7:36Well, the Azure CLI is a true CLI where you are issuing commands telling it to
7:42do something.
7:44PowerShell is more object oriented programming.
7:48And I know this concept between the difference of just a true shell or command
7:53line interface
7:54versus an object oriented programming language might feel a little fuzzy.
7:58But by the end of this set of videos, when we get to the end of it, this will
8:01make a
8:02whole lot more sense.
8:04The ultimate thing that I really want you to know is why you would use either
8:09of these.
8:10But before I get into that, let's make sure that we actually get these
8:14installed again.
8:14Choose the operating system of your choice.
8:17Windows, Mac OS or Linux, all open source, all built on the dot net framework,
8:21which
8:21is now open source.
8:23And you can choose your installer again.
8:25You can download it via right here by clicking these buttons.
8:29You can also download it by using PowerShell.
8:33So again, if you're working on something like a Windows Server core environment
8:36, you
8:37can actually download the Azure CLI via this PowerShell command right here.
8:41There's also the Windows package manager, which again is using WinGet.
8:45Easy peasy over on the Mac OS side of things.
8:48Guess what?
8:49We're just using brew one more time with brew install Azure CLI.
8:53Only thing I'll tell you right here is do notice that it's going to install
8:56Python version
8:573.10, which is, you know, one of the later versions of Python.
9:00I think the current version is 3.11 or 3.12.
9:03But nonetheless, this is going to bump it up to 3.10 to actually download and
9:08install
9:08the Azure CLI.
9:09And of course Ubuntu is going to look very similar to something that you just
9:14saw in
9:14the previous set, installing our prerequisites, installing the Microsoft
9:18signing key, updating
9:20the repository, and then installing the Azure CLI.
9:24Okay.
9:25So why, why do we care about this again?
9:28Why are we having to learn about PowerShell and why are we having to learn
9:32about?
9:33The Azure CLI.
9:34This is a much bigger fundamental topic.
9:38Ultimately, here I'm just going to bring up my terminal on the screen so that I
9:41have
9:41a little bit of writing space.
9:43Doing things from the GUI or the Azure portal, they're great for when you're
9:50first getting
9:51started or you have like a one off task that you need to implement very quickly
9:55.
9:55Hey, I need to spin up a virtual machine.
9:58Just one virtual machine.
9:59Do this one thing really quick.
10:00I'm just going to jump in the portal and spin up a virtual machine.
10:03No big deal, but if I have to do a lot of the same task over and over and over
10:09and over
10:10again and it's very repetitive and importantly that it's critical that it gets
10:15done right,
10:16doing the same thing over and over and over again can lead to human error.
10:23This differs quite a bit from if I were to create something like a PowerShell
10:27script or
10:28something like a shell script.
10:30I could create it in such a way that I only have to create this script one time
10:35, test it
10:36out and make sure it works well, and then I can rerun the script to do the task
10:40whenever
10:41I need to.
10:43This significantly reduces human error.
10:46It also significantly increases the time to deployment.
10:51Let's imagine that I had to spin up 1000 virtual desktops in Azure.
10:57If I had to do that manually, it would be an absolute pain.
11:00It would take me forever and I'd probably blow something up, you know, halfway
11:03through
11:04it.
11:05Whereas if I just created a script one time and then told it, you know, run
11:09until I have
11:10a thousand virtual machines, well, guess what?
11:14That's a massive win.
11:16Beyond that, these files, these PowerShell files or these shell files, at the
11:20end of the
11:20day, they are as simple as text files and text files can be used with version
11:26control.
11:27Also known as source control.
11:30The big win here is as these files change, as they iterate, as we improve upon
11:36them or
11:36change them, or alter them slightly, I now have a lot of control over tracking
11:41each of
11:42these changes historically.
11:44I can see what changed from one version to the next and I can always revert
11:48back to
11:48an older version if I need to.
11:50Ultimately, when we start talking about PowerShell, the Azure CLI, ARM
11:58templates, which come in
12:00the form of JSON or Bicep, what we're really talking about here is the big A
12:06word.
12:07No, I'm not saying what you think I'm saying.
12:08I'm saying automation.
12:11This is about streamlining repetitive tasks and ensuring that they're not error
12:17prone.
12:18So this is the why, this is ultimately why we're here to get started working
12:22with PowerShell.
12:23Now, there's one last thing I really want you to go out and install before we
12:28begin.
12:28And that is Visual Studio Code or VS Code.
12:31That is code.visualstudio.com.
12:34You can see when you come to this page right here, you can click the drop down
12:37and you can
12:38choose again which operating system you want to work with, Mac OS, Windows or
12:43Linux.
12:44Go ahead and take a moment right now to download and install this.
12:48Use the stable version.
12:49That's all you need for right now.
12:50Pause the video and come back to it once it's installed.
12:53Great.
12:54You got Visual Studio installed.
12:56I'm very happy that you did.
12:58Now what we need to do is we need to make sure that it's ready to work with
13:02things like
13:02PowerShell as well as ARM templates.
13:05Now, over here on the right hand side of the screen, you see all of my icons
13:09that I have
13:10right here.
13:11First by default might actually be on the left hand side of the screen.
13:14I just prefer for mine to be on the right hand side.
13:17So I toggle my preferences a little bit to push it over here on the right hand
13:21side.
13:22But don't freak out if yours is on the left hand side.
13:24It's totally norm.
13:25What I want you to look for is I want you to look for the little icon that
13:27looks like
13:28these blocks right here.
13:30Give the blocks a click.
13:32This is called extensions.
13:33And one of the cool things about VS Code is that out of the box, it doesn't do
13:36everything
13:37under the sun that you need it to do, but you can add plugins to it like
13:41extensions
13:42to help you get started.
13:43What I want you to search for first is PowerShell.
13:47And this is adding support for the PowerShell programming language into VS Code
13:51.
13:51You'll see it right here on top.
13:53It's created by Microsoft and you'll see an install button right around here
13:57where I'm
13:57circling.
13:58Give that install button a click and you'll be off to the races ready for
14:02PowerShell.
14:03Now what I want you to search for is Bicep and right here you see Bicep
14:08language support
14:09for Visual Studio Code again created by Microsoft.
14:13Give that install button a click and you're off to the races with Bicep ARM
14:17templates.
14:18Now what I want you to search for is Azure resource.
14:22Give that a click and this is what I want you to search for next.
14:25The first thing I want you to install is the second one that I've got it
14:28highlighted
14:29on the list here.
14:31Azure resources again created by Microsoft give the install button right around
14:35here
14:36a click and let that get done.
14:38And once that's done then install Azure resource manager tools arm tools and
14:44let that install.
14:46Once you have these extensions installed that is PowerShell that is Bicep that
14:52is Azure resources
14:54and Azure resource manager arm tools your environment is ready to rock and roll
14:59.
14:59As far as learning how to work with PowerShell and how to work with ARM
15:05templates.
15:06So in the next video that's exactly what we're going to do.
15:09We're going to get started using it.
15:10I hope this has been informative for you and I'd like to thank you for viewing.
Understand Cmdlets
0:00So here's what I want you to do on whatever computer that you're working with.
0:03I want you to make a directory, a folder on your computer right now called PWSH
0:08demo.
0:09Something as simple as that.
0:11Here's why I want you to do that.
0:12With that folder created, what we're going to do is we're going to make that
0:16our workspace
0:17in VS Code.
0:18Then right click over here and choose, you know, in this empty space.
0:21You can see right here I've got the Explorer as my section.
0:25And over here in this empty space, anywhere in your empty space, choose Add a
0:28folder to
0:29your workspace.
0:31Find your folder.
0:32In my case, there it is, PWSH demo.
0:34It's empty.
0:35And I'll click Add to bring it into the workspace.
0:38Now I promise me to you trust the authors of the files in this folder.
0:41Well, I am the authors of the file in this folder.
0:43So I'll say yes, I trust it.
0:45So I see PWSH demo is right here on the screen.
0:49And within PWSH demo, with it highlighted right here, I can right click and
0:54choose New
0:55File.
0:56Let's call this file get started dot ps1.
1:01Ps1 is the PowerShell extension.
1:05Now if you see this select a workspace folder to use for the PowerShell
1:08extension, choose
1:10your PowerShell demo folder that you have.
1:14When that comes up, what you'll see is down here on the bottom, it actually
1:17launches a
1:18PowerShell terminal directly in VS Code for you.
1:24So up here in the editing section, this is where you're going to type your
1:27PowerShell
1:28script.
1:29And down here in the terminal is where you'll actually test it out.
1:33So let's get started talking about how PowerShell commands are structured.
1:38The first thing you should know is they're not even called commands.
1:41They're called command let's CMD L E T.
1:47A command let is always formed in the exact same structure.
1:53That is verb hyphen noun.
1:59You can almost think about it as do hyphen something.
2:05Now here's the real kicker.
2:06You've heard me say this a few times that this is an object oriented
2:12programming language.
2:14And what we're going to do is we're going to start off with a very simple
2:18theory right
2:18here.
2:19The verb noun do something is usually telling it to do some operation with an
2:27object.
2:27Perhaps the object that I want to work with is a virtual machine.
2:34Maybe that virtual machine is an Azure.
2:36The way one of these commandlets would look would be something like set hyphen
2:44AZVM.
2:46Now thankfully because I installed the PowerShell extension, my PowerShell
2:51environment is trying
2:53to show me a lot of different options that I could use here.
2:56yours might need a little help to get it there just yet.
2:59Remember how VS code had extensions because out of the box VS code couldn't do
3:04everything
3:05that you wanted it to do.
3:07Well PowerShell is actually the same way.
3:10PowerShell out of the box doesn't have the ability even PowerShell version
3:15seven doesn't
3:16have the ability to work with Azure.
3:19What we have to do is we have to install the Azure commandlets into our
3:23PowerShell version
3:24seven environment.
3:25So with our newfound knowledge of what extensions are for VS code and what that
3:29kind of looks
3:30like for PowerShell plus the fact that commandlets are verb hyphen noun command
3:36lets.
3:36Here's what I really want you to do.
3:38I want you to type install hyphen module and then the name AZ right there.
3:49Hopefully this is starting to set up the basic syntax and drill home what it is
3:52that we're
3:53trying to do.
3:54Here's our verb.
3:55We're installing our noun a module that is basically what an extension for
4:01PowerShell
4:01is called.
4:02It's called a module and then we have to tell it which module right here called
4:05AZ.
4:06We're going to talk a little bit more about that in the next video though.
4:10Just trying to drill home how you can work with VS code and what the structure
4:14of a
4:14basic commandlet looks like.
4:16So with this being said, I'm going to go to file save.
4:21So this file is now saved and now watch this.
4:23I'm going to go to run and then start debugging right there with the F5 is
4:27another way to
4:28put it.
4:29So when I press run right here, we see down here in the terminal, it starts to
4:34run.
4:34Now it's prompted me.
4:35Are you sure you want to install this module from an untrusted thing?
4:39I'm going to say a to accept yes to all in the terminal and then press enter
4:45and boom.
4:45Now it tells me I've already got mine installed.
4:48That's great.
4:49Yours is going to take a minute or two to actually go through the installation
4:52process
4:53because all of the Azure commandlets, every single thing that you can do in
4:58Azure is all
4:58available via a PowerShell command.
5:01So it's going to go out and get all of the commandlets for all of Azure and
5:04that may
5:05take a minute or two.
5:07So once it gets done with the installation for you, now you should be able to
5:11see things
5:12like new AZ VM.
5:14What does new AZ VM do?
5:16Well, I just want you to take a moment to pause and think about what new AZ VM
5:20might do.
5:23Do do do do do do do do.
5:24It creates a new Azure virtual machine.
5:27And right here, right now at this moment, this is where I want to end this
5:31video.
5:32You already did a lot in this video.
5:34You now understand the structure of a PowerShell command.
5:38It is verb hyphen now.
5:39Do hyphen something new hyphen something.
5:43Get hyphen something.
5:45Get hyphen something.
5:47Delete hyphen something.
5:49Update hyphen something.
5:51Install hyphen something.
5:54Beyond that, you learned how to create a PowerShell script and run a script in
5:59envious
6:00code.
6:01Give yourself a pat on the back because you've already come a really long way
6:04in a short
6:04amount of time.
6:06Now in the next video, we're going to take our understanding of PowerShell
6:10commandlets
6:11up a lot when we start talking about parameters.
6:14I hope this has been informative for you and I'd like to thank you for viewing.
Use Parameters with Cmdlets
0:00Okay, so now we're going to zoom in a little bit and focus in on what it is
0:03that we're
0:04really trying to do here.
0:06We got commandlets down.
0:07Remember we did install module from above, and then we gave it a name like AZ.
0:13That was actually the name of all of the Azure commandlets.
0:16That's the name of the module.
0:17It's called AZ.
0:18And that's actually why every Azure commandlet has an AZ in it.
0:24You'll have your verb, you know, do hyphen something, right?
0:27Do, then you'll have hyphen AZ, then some object.
0:32That's how you know it's an Azure commandlet.
0:34So remember new hyphen AZ VM.
0:38That's how I knew that this was going to create a new Azure virtual machine.
0:43Now let me show you how we can start using this knowledge and building upon it.
0:48You see, when we were talking about being an object oriented programming
0:51language, we
0:52were saying things like, I want to perform some action, like get the details of
0:57an
0:57Azure virtual machine.
0:58I want to know if, you know, what size it is, or, you know, is it currently
1:03running?
1:04Really any detail related to this virtual machine is something that I need to
1:08be aware
1:09of.
1:10But by itself, get AZ VM doesn't really get the job done, does it?
1:15That doesn't tell you which virtual machine we want to get.
1:18And this is where we start to talk about the next concept.
1:20And that's parameters.
1:23Some parameters are required in order to run particular PowerShell command
1:28links, like
1:29get AZ VM.
1:30Some parameters are not.
1:32They just give us additional flexibility or ways that we can run or basically
1:36filter
1:37out data that could be coming back.
1:40Ultimately, when I'm trying to get an Azure virtual machine, I'm trying to get
1:44the details
1:45about a single Azure virtual machine.
1:48So what we need to do is we need to tell this commandlet, we have some
1:51additional parameters
1:52for you to run.
1:54So check this out from my terminal or excuse me, from my VS code environment
1:58right here,
1:58I'm going to type a hyphen and immediately what pops up is all of the different
2:03parameters
2:04that I could run.
2:06The first parameter I see is resource group name.
2:09Now at this point in your Azure journey, there's a little bit of an expectation
2:13.
2:13If you're going for the AZ 140, that you're familiar with the basics of Azure,
2:17like what
2:17resource groups are.
2:19I happen to have a resource group and a virtual machine already running my
2:23resource group
2:24name, which I'll type in right here, then needs to be followed by the actual
2:29name of
2:29the resource group.
2:30In my case, I can type AZ hyphen 140 hyphen demo.
2:36That's the name of my resource group.
2:38Then what I need to find is my virtual machine.
2:41So I'll type a hyphen again, and then I'll specify the name of my virtual
2:46machine.
2:47In this case, the name of my virtual machine is P W S H demo.
2:51That's the name of my virtual machine.
2:54Now this is the minimum this needed to actually run this command line.
2:58These are the two required things because at this point, you would know, okay,
3:02go look
3:02in this resource group for a virtual machine with this name.
3:06There shouldn't be any duplicates in there.
3:08So it should be able to return the details back to me.
3:10Now, don't worry about running this command yet.
3:13You're not there.
3:14I just want you to see that it works.
3:16I'm going to do a run start debugging.
3:18It's going to run the script down below and boom, look at this.
3:22See, here's all the details of my virtual machine.
3:24I can see its location.
3:26I can see the name.
3:27I can see its ID.
3:28I can see what subscription it belongs to.
3:31I can see which availability zone it's in.
3:33I can see that it is succeeded in provisioning.
3:36And then inside of that are a lot of different things here called sub objects
3:40that we're
3:41not quite ready to talk about yet, but we will be soon.
3:44The point is, is that I wanted you to see, first of all, it's not just enough
3:48to usually
3:49have a commandlet.
3:50We usually have to give the commandlet additional information on how to run by
3:55giving it parameters.
3:56Now, the real question for you becomes, how do you know which parameters or
4:01even which
4:01commandlet you want to run in the first place?
4:04What I'm going to do is I'm going to collapse my little browse window over here
4:08to give
4:08me, give myself a little more space to work with on the terminal and I'll zoom
4:12in just
4:12a little bit more so the font is pretty big.
4:15Now I'm going to work on the terminal for just a second and I want you to see
4:18how this
4:19works.
4:20One of the most powerful commandlets that you can use is actually get help.
4:26So if I want to use get help and then I can tell you what what commandlet do I
4:30want help
4:30with like get AZVM, I can press enter and now it tells me details about the
4:37actual commandlet
4:38itself.
4:39First of all, I see the name of the commandlet.
4:42I see a quick synopsis like a description gets the properties of a virtual
4:46machine and
4:46then I see get AZVM can run with a bunch of different parameters.
4:53Now this is the part that needs a little help for me to explain what it is that
4:58it does.
5:00What you're seeing here is the parameters name, what is the parameter called
5:06and then
5:06what comes after that is the parameter value.
5:11So in this case, you just saw me type it right up above.
5:13You have a resource group name and then right here you see system string.
5:18This is basically saying text of the resource group name.
5:23Then I have name right here.
5:25Well, in this case, we were looking for an Azure virtual machine.
5:28So it's what is the name of the virtual machine and then text of the virtual
5:32machine name.
5:33What's confusing about this though for the first time you're seeing it are the
5:38brackets.
5:39Anything that's denoted in brackets is optional to type.
5:45So when I see get AZVM, it was optional for me to type out the parameter name
5:51resource
5:52group name.
5:53However, providing the resource group name was not optional.
5:58The system string right here is not in brackets.
6:01No, that means I have to provide it in order for this command to run.
6:05It was optional for me to provide the parameter name of name, but it was not
6:12optional for
6:13me to provide the parameter value of name.
6:16Check this out to confirm that.
6:18Watch this.
6:19I'm going to go back to my script above and I'm just going to delete out that
6:24and that.
6:26Okay.
6:27See, I have get Azure virtual machine, but I'm not specifying the explicit
6:32parameter resource
6:33group name.
6:34I'm just specifying that the resource group's name value, AZ140 demo goes there
6:39and the virtual
6:40machine name of PowerShell demo goes there.
6:43If I run this script one more time, does it still work?
6:47Hold your breath.
6:48Look at that.
6:49See, it's still worked.
6:51Why is this a thing?
6:53These are known as positional parameters.
6:58This means that resource group name right here always goes in the first
7:04position always.
7:05If resource group name for the get AZVM is always going to come first, there's
7:12no real
7:13reason to explicitly type it because we know the value that's provided here is
7:18going to
7:18be attached to the first parameter.
7:20And the virtual machine name always is the second parameter.
7:25So there's no real reason to have to specify that's the name because we know
7:28that the value
7:29that comes second is attached to the virtual machine name.
7:33Now look at this right here.
7:35You see this, this means that everything else in this block is going to be
7:42optional.
7:43We don't have to provide a status parameter.
7:47We don't have to provide a default profile parameter.
7:50We don't have to provide a default profile value.
7:54We don't have to provide display hint parameter or the value.
7:59These are all options that we can add to it.
8:02The only thing that are required are the things that aren't in brackets.
8:07Now wait, just wait, there's more.
8:10Get help is actually the abbreviated help.
8:14This is usually used when you just need to see, hey, what are the parameters
8:18that I have
8:18to require in order to run this command and are any of them positional.
8:24But if it's not really clear what the parameters actually mean or what you
8:28should do with this
8:29particular command, what you might want to run is just help, not get help, just
8:35help
8:35by itself.
8:36When you do help get a ZVM, you get a lot more output.
8:44See, it keeps going.
8:45Yeah, exactly.
8:46See, it's big.
8:48It comes with examples.
8:49It might show you what example outputs look like.
8:53But beyond that, look at this.
8:55When it comes down to the parameters, so you see the same beginning, you get
8:58the name,
8:58the synopsis and the syntax, but then scroll down to the parameters.
9:04The parameters here are sorted alphabetically.
9:07It'll tell you if it's required parameter, if it's a positional parameter, it
9:12'll even
9:12give you a description of what the parameter is trying to look for.
9:16So let's scroll down to resource group name.
9:19Look at this.
9:20It is a tricky one to interpret because when you look at required and it says
9:25false, you're
9:26like, wait a minute, remember typing resource group name is not required, but
9:33it is a positional
9:34parameter.
9:35It comes in position zero.
9:38So providing the value is definitely going to be required for this to work.
9:42So this was another really, really big video where at the surface level, it
9:46doesn't seem
9:46like we did a whole lot.
9:48We just tacked on two parameters that helps us find a virtual machine.
9:53But under the hood, learning where those parameters come from and how to
9:56interpret the help is
9:58actually a massive step in understanding how to work with PowerShell and
10:02navigate PowerShell.
10:03Here, I'm going to type Q right here so it exits out of that terminal real
10:08quick and
10:09back in my script.
10:10I'll just do a command Z to get my text back.
10:13Okay.
10:14So with that being said, in the next video, we're going to talk about the next
10:18step in
10:18working with PowerShell and that's variables.
10:21I hope this has been informative for you and I'd like to thank you for viewing.
Store Data and Objects with Variables
0:00So get AZVM. Let's run it one more time. Let's go to run, start debugging.
0:06Pretty cool.
0:07I can get these details right here printed out to the terminal. But all this
0:10does is print it out to my terminal.
0:13And that really is just more like a command line at this point. And not like an
0:17object oriented programming language.
0:19This is where we start to shift our focus a little bit. This virtual machine,
0:23these details that I got right here,
0:25all belong to a single object. That is the virtual machine itself. These right
0:32here, these VM ID, name, type, location, tags,
0:36these are all properties that belong to this virtual machine. They define how
0:42this virtual machine is currently running.
0:45That is our object. So how could I start to use this? Well, one of the
0:50important things that we need to do is
0:53when we get details on an object, like my virtual machine, we need to hang on
0:57to those details for a little bit so that I could recall them later and maybe
1:03change them.
1:04This is usually done usually by variables. So when we use a variable, we run a
1:10commandlet like get AZVM.
1:14And what get AZVM is doing is it's returning the virtual machine back to the
1:19terminal right here and printing it out to the terminal.
1:22But what I might want to do instead is now save it in a variable and variables
1:27are denoted with a dollar sign.
1:30So you put dollar sign and then you give the variable any name that you want,
1:35like my VM. And you set it equal to your commandlet.
1:41Watch this. See how this syntax works. Right here in front of get AZVM, I'll
1:47put dollar sign, my VM,
1:50and set it equal to the results of get AZVM. Now, I'm going to save this and I
1:56'm going to run it.
1:57You're going to see the yellow squiggly lines right here. And it's warning you
2:00that, hey, you've created this variable,
2:03this variable, my VM, and we're even assigning data to it with the get AZVM
2:09commandlet.
2:10But you're not actually using it anywhere. Watch what happens when I actually
2:14run this commandlet now.
2:15I'll go to run and start debugging. See it down here? Hmm. Wait a minute. It
2:20ran the script right there on this line.
2:24And it didn't throw any errors. It didn't blow up on me. It just didn't return
2:28anything back to the terminal.
2:30That's because by default, when we run commandlets and then save the details in
2:34a variable, it's done just that.
2:36It's saved the details, the object, the virtual machine in my variable and done
2:42nothing else with it because we haven't told it now that you have these details
2:48in the variable.
2:50It's time to print them out or change some detail or some factor to it. So
2:55watch this.
2:56Whenever I want to recall the variable, like, printed out to the terminal, I
3:02can then just type right there, my VM.
3:06By simply just recalling it like my VM right here, that tells it print out the
3:10details to the terminal.
3:12So I'll run the script one more time and boom, there we go. Now it prints it
3:16out to the terminal.
3:18Even cooler, I can get smaller details of this virtual machine by using dotted
3:24notation.
3:26For instance, maybe I just want to get the name of my VM.
3:30So I'll say go into my VM that you have right here and just return the name
3:35property.
3:37So I'll save this, run it one more time.
3:41And there we go. Now it's printing out just the single property out to the
3:46terminal.
3:47So at this point, we're holding the virtual machine object in RAM and we can
3:52now use this virtual machine in different parts of our script.
3:57And that's where I'm going to end this video. I just wanted to introduce the
4:02concept of variables about holding details in RAM.
4:06Actually, I'm going to add one more thing to it. You don't have to hold the
4:09results of a command in a variable.
4:13You could actually hold anything that you want, like my string. And I could put
4:17here is some string, or I could put my number and say one, two, three, four,
4:28and I could put my array.
4:31And I can actually hold multiple things like you see right here could hold the
4:36value of one, two, or three.
4:39The point is, is variables can really hold any type of data, any data type or
4:43any structure or any object like a result of running any sort of command in a
4:49variable.
4:50You can then recall that variable or those details further on in your script.
4:56So this has been understanding variables. I hope this has been informative for
4:59you and I'd like to thank you for viewing.
Evaluate Objects and the Pipeline
0:00So this is where we go from the basics to pretty advanced stuff.
0:04At this point, we've talked pretty conceptually about the fact that get AZVM
0:10returns a virtual
0:11machine object.
0:13That virtual machine object has properties that define the virtual machine.
0:18We can store that virtual machine object in a variable.
0:22But now we really need to talk about the object itself and the pipeline.
0:29This is where the power and power shell comes from.
0:32And this is the part where your brain is going to melt a little bit, but bear
0:36with me on
0:37this one.
0:38Let's go back to help get AZVM.
0:41And I want to scroll down just to hair until we get to the outputs, scroll down
0:46, down,
0:47down.
0:48And here we see the outputs.
0:51What is this?
0:53This is the official object itself.
0:57This is the dot net defined object.
1:02Specifically, this is known as a class.
1:06Classes define the exact structure or properties that an object has.
1:13So in the event of a virtual machine, all of the properties like name, VMID,
1:21status or
1:22provisioning status, yada, yada, yada.
1:25All of those properties were predefined upfront, basically like a template.
1:31Put it in another simpler way.
1:33I wanted to define what a car was.
1:36Not a specific car, just in general, what a car is made of.
1:41It would have tires.
1:44It would have, you know, rows of seats.
1:47It would have a steering wheel.
1:52It would have an engine.
1:54It would have a transmission.
1:59And this would be how I might define my car class.
2:04So when I was ready to start creating specific cars, I might create a truck
2:11like a Ford F-150.
2:14And its tires might be, you know, 33 inch mud tires.
2:20It might have two rows.
2:22Of course, it'll have a steering wheel.
2:25It might have a V8 motor.
2:28It might have a six speed automatic transmission.
2:33This would stand in pretty stark contrast to something like a Tesla Model S pl
2:38aid, wouldn't
2:38it?
2:39It would have more like sport tires.
2:43It still has two rows and a steering wheel, but it has no motor.
2:48It has the electric motor.
2:51I don't even know what the transmission is, but it's going to be a great one
2:54because that
2:54thing does like zero to 16, two seconds.
2:57The point is, is we see how the car class defined a basic structure of what
3:02needs to
3:03happen to make a car.
3:05And then we can create different kinds of cars based on that structure.
3:09The same thing is happening here with the virtual machine.
3:13The class defines all of the properties that can be in a virtual machine.
3:18Even when you create a virtual machine, the values of those properties are what
3:22make it
3:23unique.
3:24So you might be thinking to yourself, well, what are all of the properties that
3:27could
3:28exist in a virtual machine?
3:30When you do help get a ZVM, you see this is the output object that it's going
3:35to get
3:36back to me.
3:37I'm going to copy this and flip on over to my documentation here for a second.
3:42I'm going to search for Microsoft and then paste in the actual property itself.
3:48The very first thing that comes up shows me the PS virtual machine class.
3:53Now when I scroll down, see here are the properties.
3:58These are all of the details that make up the virtual machine class.
4:03So this is really useful because you can immediately start seeing the kinds of
4:07data
4:07that you're going to be getting back from your PS virtual machine class, but it
4:13goes
4:13deeper than that.
4:14Look at this.
4:15If I run the commandlet one more time, let's go ahead and delete this out, save
4:19it, and
4:20run the commandlet to start debugging real quick.
4:24Let's pick on hardware profile for a second because this really defines the
4:28virtual machine
4:29size.
4:30You know, instead of seeing something like a D4, VS2 or whatever it is, it
4:37shows me
4:37VM size instead.
4:39What does that really mean?
4:40We'll flip on back here for a second and scroll up to hardware profile.
4:46When you give that a click, what you find now is that the hardware profile
4:51property,
4:53when you click this right here, this is what it's really referring to when we
4:56talk about
4:56the hardware profile property.
4:59So when you look at the property value, it shows you that your value is going
5:03to be a
5:03hardware profile.
5:05You give that a click and it is a subclass.
5:07There is a class inside the class.
5:10So when you scroll down some more, you start to see your properties are going
5:14to be your
5:15VM size.
5:19So if I'm thinking about it, I'm going to have my VM here, which has all the
5:23properties
5:24like the name, resource group name, and then it's going to have hardware
5:30profile, isn't
5:31it?
5:32So the hardware profile is going to have properties of its own.
5:36So it's properties within the properties.
5:38In this case, it'll have VM size and scroll down some more.
5:42You'll see it'll have VM size properties.
5:45So if I jump back to my terminal and bring up the my VM resource right here, I
5:52see the
5:52hardware profile refers to VM size.
5:55Would you remember how we could look into hardware profile?
5:59It was with the dotted notation, my VM hardware profile, I can tab to complete
6:05that and press
6:06enter and ah, look at that.
6:08See, now I see the sub properties of that particular class and this virtual
6:13machine is
6:14a standard B1s.
6:16Pretty cool.
6:17But I want you to see where it gets even more powerful than this.
6:21It's not just the fact that we've defined the object by defining its properties
6:25through
6:25a class and then maybe sub classes with sub properties.
6:30It's also how we use it in PowerShell.
6:33Get a ZVM does an incredible job of getting the details of a virtual machine.
6:38But what happens when I want to stop the virtual machine from running?
6:43Let's see.
6:44If I do help stop a ZVM to turn it off and press help right here, this is a
6:49valid PowerShell
6:51command.
6:52It stops an Azure virtual machine.
6:54So check this out.
6:55I'm going to show you this is the really, really cool part.
6:57Scroll on down past the parameters and see it accepts one input and that is via
7:05string.
7:06Now it's going to turn out a specific object.
7:09It's the compute long running operation.
7:11It's basically just a true or false.
7:13Did it run?
7:14But what is this input of string?
7:16That's just text.
7:17Well, with a little bit of help, we can go back to our parameters up above and
7:22we see
7:23stop a ZVM again is looking for a resource group name and the virtual machine
7:29name.
7:30Well, we got those already from get a ZVM and this is where the true power of
7:36PowerShell
7:37comes in.
7:39Check this out.
7:40I've got the virtual machine.
7:42I'm storing it in a variable.
7:45Now I want to use it.
7:47So what I'm going to do is I'm going to call the variable right there by just
7:51saying
7:51my VM, but I'm going to pipe it into stop a ZVM.
8:00I don't have to type anything else.
8:02Why?
8:03How does that work?
8:04The power in PowerShell comes from the fact that we can take an object, whether
8:10from a
8:10commandlet or from a variable and send it into a proceeding commandlet and it's
8:19smart
8:19enough to match the resource group name and name parameters from the input
8:27object.
8:29Let that digest for a second.
8:31The virtual machine has a property of resource group name and name.
8:38When I send this variable into stop VM, it's smart enough to map this virtual
8:45machine's
8:46resource group name to the resource group name parameter in stop a ZVM and this
8:52variable's
8:53name property to the name parameter in stop a ZVM.
8:59So watch this.
9:00I'm going to do command S right here to save my script and we're going to go to
9:07run and
9:07start debugging.
9:09There it goes.
9:10Okay, it says, do you want to stop the specified virtual machine?
9:13I'll say yes.
9:16And then you wait a few seconds because this is a long running operation.
9:20I'll come back to it when it's done.
9:21I'm going to pause right here.
9:23And there we go.
9:24It looks like after 48 seconds looking at the screen right here, the operation
9:29has succeeded.
9:30Do you see how powerful that could be?
9:33Now watch this.
9:34I'll delete variables entirely and show you how we can just use the command
9:39lists to work
9:40directly with each other.
9:42Start a ZVM and watch this.
9:45I'm going to use the force parameter right here.
9:48So that way any of these prompts right here that say, hey, are you sure you
9:51want to continue?
9:52Force automatically accepts that more or less.
9:54It makes it go and forces the command to run.
9:58So in this case, I'm not storing anything with variables.
10:00I just want the virtual machine to start.
10:02So I'm going to get the virtual machine with this commandlet and immediately
10:06pass the resulting
10:07output, the PS virtual machine class object directly into the start a Z VM
10:14commandlet.
10:15We're going to run it one more time.
10:17This will probably take.
10:18Oh, oh, start a ZVM does not have a force parameter on it.
10:21Silly me.
10:22We'll go ahead and command S and run it one more time.
10:27And there it goes.
10:28It's going to take, you know, 30 or 40 seconds.
10:29So I'll come back to it once it's done.
10:3223 seconds is what it took to start that virtual machine and the operation has
10:36succeeded.
10:37So this really ratcheted our skills up a notch, didn't it?
10:42We talked a lot about where objects really come from.
10:46Importantly, how can you find out what objects a particular commandlet is
10:50working with, both
10:52as an input as well as an output?
10:55Where can you find out what what what properties come with a given object?
11:00And then how do you pass an object from one commandlet to the next using the
11:06pipeline?
11:07This is where object oriented programming and the power and power shall come
11:11from.
11:12I hope this has been informative for you and I'd like to thank you for viewing.
Login to Azure and Set a Subscription
0:00Now, the final thing I want to leave you with here is so that you can get
0:03started directly
0:04from your terminal or understand how it is that you can begin working with
0:08Azure.
0:09This is another critical thing to understand when it comes to working with
0:12PowerShell.
0:13You can do this, what I'm about to do, you can do this from the terminal in VS
0:16code if
0:17that's what you want to do.
0:18That's going to be perfectly acceptable or you can do it from just a standard
0:21shell.
0:22Now, here I am on Mac OS.
0:24I need to launch into PowerShell first by typing PWSH.
0:27Now, here's the kicker.
0:29My computer, this shell that I'm in right now has no direct connection to Azure
0:34by default.
0:36I have to log into Azure from this PowerShell terminal.
0:40The commandlet to do that is log in AZ account.
0:45Press enter and watch what it does.
0:46It launches a terminal, right?
0:49Or excuse me, it launches a web browser where I can then say I'm logged in with
0:53this account.
0:54Let's go ahead and click OK to proceed logging in.
0:57It tells you authentication is complete, you can return to your application.
1:00Flip on back and it's sure enough, I am logged in to my account.
1:05Now in this case, I see right here that it logged in, but importantly, it has a
1:09default
1:10subscription set within the shell itself.
1:13If I have multiple subscriptions, which I do, this could become a problem
1:17because with
1:18the default subscription set to pay as you go, when I specify things like my
1:23resource
1:23group, it's going to be looking for resource groups that belong to the pay as
1:27you go subscription.
1:29You may want to change that.
1:30So check this out.
1:31We'll do something like get AZ subscription and press enter right here to see
1:36the list
1:36of my AZ subscriptions.
1:39Now I see my AZ subscriptions listed here.
1:43Let's have some fun.
1:44What I want to do is I want to get a specific AZ subscription, but be able to
1:50pipe it in
1:51to a set AZ or select AZ subscription to change my default subscription.
1:56So in this case, I'd be changing from my pay as you go to my Knox's
2:01subscription.
2:02Well, this is an interesting one, isn't it?
2:04Because this particular commandlet returned two objects back to me.
2:09So what happens when I want to filter this down to only one?
2:12Watch this.
2:13I can do get AZ subscription.
2:16I'll send them both, both objects immediately in the pipeline to a commandlet
2:22called where
2:23object.
2:25This is a where clause where we're looking for a specific property.
2:29What we do here is a little quirky.
2:31So follow me on this.
2:32We're going to open up braces and then we're going to say dollar underscore
2:37period.
2:38Now what does this mean?
2:39This means I want to evaluate each one of these objects.
2:44We're going to evaluate both the pay as you go subscription and the Knox's
2:48subscription.
2:49What are we going to evaluate?
2:51We're going to say where the property of name is equal.
2:55We specify this with hyphen EQ and then we're going to look for something
3:00called Knox's.
3:02So immediately I'm not going to run the rest of this.
3:04You can see it kind of showing me a syntax, you know, option right there.
3:08I'm just going to run this particular commandlet.
3:10So you can see what it does with the where object.
3:13Now I'm getting both subscription objects, passing them into my where clause.
3:20I'm evaluating both objects, the name property, and I'm finding the one that is
3:26equal to the
3:27Knox's name right there.
3:29So now I have my specific subscription that I care about.
3:33What I'm now going to do is I'm going to pipe that further down the pipeline
3:38and say
3:39select AZ subscription and press enter.
3:45Remember this is cool because it's going to be smart enough to know to take
3:49this input
3:50object right here and all of the required parameters that select AZ
3:54subscription needs
3:56to know like the name or the ID or the tenant ID or the state.
4:01All of those are going to be mapped directly in.
4:04So I don't have to specify any of those other parameters.
4:07I press enter, I wait a few seconds, a few seconds more, and there it is.
4:13It's done.
4:15This output with no errors right here tells me that my current default AZ
4:20subscription
4:21is now set to be my Knox's subscription instead of my pay as you go
4:25subscription.
4:27This is reinforcing the power of the pipeline while also adding a little new
4:31thing for you
4:32to where you can figure out how do I filter out the results when I have
4:36multiple objects
4:37returned back to me.
4:38This is using the where object clause.
4:40PowerShell is extremely powerful and I can't stress this enough.
4:44We've really only touched on the tip of the iceberg.
4:47This was really only meant to be a primer to get you the bare minimum that you
4:51need in
4:52order to start working with it throughout this course.
4:54But I really want to stress that you need to take the time to learn more about
4:59PowerShell
5:00and dig deep into the really nitty gritty features that it can do.
5:05We have content dedicated to just learning PowerShell version 7 right here at
5:10CBT Nuggets.
5:11It is worth your few hours to hit that search bar and watch that content end to
5:17end.
5:17No matter what your role is in the technical environment, you will be better
5:21for learning
5:22this.
5:24And at this point, you also know how to get your shell logged in to Azure.
5:29Now you can do things like get AZVM, specify a resource group name of AZ140
5:38demo and a name
5:40of PowerShell demo because I'm logged into Azure.
5:45Uh oh.
5:46Well, obviously that's in a different subscription.
5:49I just changed my subscription to be the Knox's subscription.
5:53Hang on.
5:54Let's hit up a couple of times and change this back to pay as you go.
5:57Let's do that real quick.
5:59Duh.
6:00Should have thought about that pay as you go.
6:04All lowercase.
6:05Yep.
6:06Case sensitive does matter on Linux based machines.
6:08So we'll change my subscription back and hit up a couple of times, get the
6:13virtual machine
6:13details.
6:14There it is.
6:16So now we know how to log into Azure from the shell.
6:20How do we set our subscription?
6:22We also learned about how to do things like filtering with the Wear Object
6:25clause.
6:26I hope this has been informative for you and I'd like to thank you for viewing.
CHALLENGE
0:00My challenge to you was to understand the subscription object and its available
0:06properties.
0:07So where do you go to figure out what the name or the name of the class is that
0:12defines
0:13the subscription object?
0:14That was the help clause.
0:16So we'll say help get a Z subscription right here.
0:21Scroll on down until you get to the outputs.
0:24Hang on, I got to scroll up.
0:26I got to find these outputs.
0:28There it is right there.
0:29It's not easy to see.
0:30There's inputs of a string and outputs right here.
0:33PS Azure subscription is the object that you're looking for.
0:38Flip on back to documentation.
0:40We'll search for Microsoft.
0:43Paste in the object itself.
0:45There is the PS Azure subscription class.
0:48And from here, you can see the properties of that Azure subscription.
0:53It's really, really important to understand how commandlets treat objects, both
0:58as in
0:58inputs, as well as outputs, and understanding what are the properties that are
1:02going to
1:03come back from these particular objects.
1:06I hope this has been informative for you and I'd like to thank you for viewing.
Team training path
Turn this skill into assignable team training
This free skill is a preview of the courses your team can assign, track, and report on with CBT Nuggets.
$708
seat / year