[Autogenerated] Alright, let's continue on our journey.
We're going to go back to the automation account,
we're going to take a look at run books and desired state configuration.
So let's go to run books and let me give you the rundown on run books first.
Under process automation.
Run books.
This is where you can create a run book from scratch.
We can import a run book safe from our local system
or we can browse the gallery.
The gallery is pretty cool.
It defaults to GitHub but you can also look at the PowerShell gallery and
you may find that somebody has already created a run book that
accomplishes the goal that you had for your business.
So the idea here is that you can import one of these,
you bring it into scope into your subscription,
need to give it a name, I'll just call this import run book,
you choose what PowerShell engine.
runtime you want,
you've got 5.1 that's PowerShell desktop or
PowerShell core that is in public preview.
As of this recording, I'm going to choose 51,
then you import now things can get a little bit hairy
in the run book space number one,
you want to make sure that you've updated your PowerShell modules.
If you're going to use PowerShell seven,
you want to make sure that you have the seven modules actually available.
You can install your own custom modules into the automation
account and reference those something else to be concerned with
is the concept of authentication,
I had mentioned that the default way to authenticate or at least
the V one way to authenticate is to use the run as credential
but the V two way to go is to use a managed identity that can
get a little bit snarly.
The good news is that we don't have to worry about
that for the purposes of the exam.
The idea is that you can work on your code here and then you can test the run
book before you publish it and make it available for you.
So let me go back to my run book list and I have a gallery run book
that I've brought in called Start Stop VM by tag.
This is going to allow you to either issue a shutdown or a startup command to
Azure or non Azure VMS based on their taxonomic tag value.
So this could be useful because you may want to schedule a fleet of
virtual machines to start and stop on your schedule.
If you don't need them for certain periods of time,
why pay for them to run This is one of the most popular
use cases of the run book in general.
I want you to think about the automation account.
Run book is a convenient cloud store for your systems
administration automation scripts.
Okay,
now let's go to edit and we'll look at the raw code then
we can go to test Pain and test it out.
So you're going to wind up if you're using the portal to be
doing your debugging and optimization here by iterating
between the edit and test pain screens.
In this case I have a virtual machine named VM three A and
let me verify on my other monitor because I actually
forgot what the tag is called.
The tag is called.
Post name and the tag value is VM three A and again the parameter
definitions are entirely up to you or whoever created the script.
It's just that there's surfaced graphically here in this test console and
the logic of this script is shut down True will do a shutdown shutdown false
will do a startup and you can run the run book in the cloud or if it's an
unprejudiced sys or off cloud target,
you can specify hybrid worker and then choose a hybrid worker group.
I'll make sure to show you that in just a moment but
for now I can click start now.
Unfortunately it's not going to show your verbose warning and
error screens until the test completes here and it can take a
little while for automation to work.
I think it's what's called the Cold Start problem that Azure has to scramble
to allocate a VM to power your job etc looks like I've got some debugging
here nuts Well again this is a real world case where you wind up iterating
in between the edit screen and the test screen over and over Once you're
satisfied with your run book,
you can publish it and that then makes it available
in your account for execution.
So we can come down in the automation account properties under run books.
Let me choose a published one.
Start stop VM by tag.
I know I'm not going to actually be able to do this.
You can run it manually by clicking start or we can link it to a schedule.
So if you want your run book to run on a schedule,
the first thing you'll do is come under resources schedules and
create yourself a schedule one or more schedules and then you
can link the job to your schedule.
You might have one or more schedules, one for startup, one for shutdown.
These run books can also be triggered through webhook you can create
an http listener and then when you send a request to that listener
that would trip off the run book as well.
Let me see, I had mentioned hybrid workers and that kind of stuff.
But let me come back to the root of my automation account
again will come down to hybrid worker groups.
Again,
the concept of the user hybrid worker group is it provides
high availability for your machines.
So in this case I've created a default worker group
and if I select hybrid workers, I've got my arc to machine and VM one in here.
Now I don't want VM one in here,
I'm going to create a worker group that includes just my to Azure arc machines.
So I now can click add let's for some reason.
Arc one.
Oh, here it is, win, it has a different host name,
I'll select my first arc machine and add this to the group.
And again,
the idea here is that we've got high availability if one of
our machines is unavailable or offline,
the run book jobs on prem or off cloud will still work because they're all
communicating with each other and with Azure over TCP 443.
Take in a little while for Azure to boot out my Azure virtual machine,
let me try a hard refresh and see if that fixes it hasn't shown up yet.
But eventually we should find that just my two arc
servers are in this worker group,
we can go to jobs to see a history of run book executions.
Lastly under shared resources.
This as I said,
is a place where you can store and reference
credentials and digital certificates.
If you're doing python run books, you can stage python packages,
you're doing PowerShell you can add modules here.
Again, you'll notice historically this has been a PowerShell 51 back end.
So you have the Azure RM modules indicated if you want to
standardize again on PowerShell seven,
you'll want to verify and do the work to make sure that you've
got the latest and greatest modules available.
Likewise, in order to use your administrator created modules,
You'll want to install those here, so they're available in your automation account