In the previous labs, we learned how to configure
machines with custom script extension and desired
state configuration.
The downside of using these type of configurations is that the
configuration is only run once, and configuration may drift either
by someone logging into the server and changing things
or uninstalling certain software.
The way in which we can ensure that the state of the virtual
machine is maintained is with automation
state configuration.
So let's go ahead and configure that in this lab.
To start out, we're going to pick up from where we left off
in the previous lab.
And the first thing we're going to do is we're going to go to the
search bar and we're going to look for automation accounts.
So go ahead and look for that service.
And we're going to create a new service.
So go ahead and click on the create button.
And let's go ahead and create this in our resource group that
we have been using.
And I'm going to call this az400vl as in video the lessons auto.
U.S. East is fine.
The identity says find a system assigned, networking I'm going to leave
public access, no tags, review and create.
All right.
It's going to take a couple of seconds to be deployed.
Shouldn't take too long.
All right.
Once it has been created, let's head on over
to our resource.
And well, here you can see details about your resource in
the overview page.
What we need for this lab is the state configuration,
which you will find within the configuration management menu.
So let's go ahead and click on this.
And here you will be --
Well, when this loads, you'll be able to see details
about the configuration of the nodes that you have added to
this automation account.
Right now we have not added one.
So let's go ahead and first add a configuration by clicking on
the configuration tab.
And here we need to locate our file.
That -- well,
yeah.
First, we need to add the configuration
and then we're going to locate our configuration file,
which is going to be the same one that we previously uploaded,
the one for the Windows Server.
And it's going to to be the ps1 file.
You can see that I still have it in my desktop.
You may recall that this was what I called it in the previous lab.
So go ahead and click on Open.
And we need to name this just like our file and click on
Okay.
Oh,
Never mind.
I needed to add the name of the configuration,
which I still have open right here.
And you may recall its DSC configuration
with a capital C.
So let me input that right there then click on
Okay.
It seems it's not pick it up.
Let me hit refresh.
Okay.
There it is.
So once
it appears right there,
go ahead and click on it like I did.
And what we need to do now is compile it.
This is going to convert it. --
well, it's going to create an MOF file.
So that it can be applied to whatever nodes you add to the
state configuration in your Azure automation account.
So once you do that, it's great to tell
you it succeeded.
So the way you can verify that is going back to your Azure
automation account, go into state configuration
and then clicking on the compile configuration step.
You can see it hasn't appeared yet,
so it's going to be a matter of refreshing for a little bit.
We need it to appear here in order to proceed.
So in the meantime, I'm going to go back to
my virtual machine, the one with Windows,
and I am going to remove the desired state configuration.
You go to the virtual machine, you go to the settings menu,
and then you click on extensions and applications.
And you will see that we still have the previous disabled state
configuration there.
Let's go ahead and uninstall it.
And this will take a couple of seconds as well.
In the meantime, let's go ahead and refresh this
in order to see our our configuration after
it has been compiled.
Once you see it like this,
you'll be able to add a node
and assign this configuration to the node.
So first, I just want to make sure that this is removed.
Let's give it a couple of seconds.
Okay.
It says that the extension has been successfully deleted.
Let me refresh.
Okay.
Maybe a hard refresh.
Okay.
You'll see that the extension no longer appears listed right here.
This is where we had the desired state configuration for our
Windows machine from the previous lab.
So move on back to the Azure automation account,
the tab where I have the automation account,
click on state configuration.
Now we're going to click on nodes,
and you can see we don't have any nodes right now.
Let's go ahead and add our very first node.
And we're going to select the
Video lesson window VM, which is the one I just removed
the extension from.
If you removed it successfully, it will say status not connected.
So once you have selected the VM, go ahead and click on Connect.
And now it's going to allow you to select a configuration.
This is the one we just compiled, so go ahead and select that.
Next, it's going to ask you if you want to modify the time it
searches for a new configuration file and the time it
installs it, every time it downloads a new configuration
file.
And in the configuration mode, we can either tell it to just
apply the configuration to apply and continuously monitor that the
state has been maintained or to apply and autocorrect.
So if the configuration of this machine gets changed drifts,
it will automatically
correct it and make it have the configuration that we specified
in the configuration file.
That's the way you maintain state in this VM.
So I'm just going to select this option.
This allows you to override older modules.
I'm fine with that.
And this will allow you to reboot the node in case it's needed in
order to comply with the configuration.
And here are the options that you can select for that last setting.
So I'm just going to go ahead and click on
Okay now.
And it's going to connect to the VM and it's going to set up that
configuration in the machine.
You may recall that this machine already had IIS installed,
so it shouldn't take long.
You can see IIS is still available in this machine.
So let's head on back to the Azure automation account.
Let's click on desired state configuration and I guess this is
going to take a while as it's updating.
Let's go ahead and click on refresh.
A hard refresh will.
Let's give it a --
Okay,
there it is.
So you can see that now, our Azure 400 video lesson
Windows machine has been added to our Azure Automation state
configuration,
and it's listed as compliant since we configured it to auto correct.
If someone logs into this server and uninstalled Internet
information services within 30 minutes max,
it's going to identify that drift,
that configuration change and it's going to attempt to fix it.
So that was Azure Automation State configuration.
Thank you for watching.