Day 41: AZ-140 Pt.5.1 - Monitor and Maintain WVD - Automate


Section 5: Monitor and Maintain a WVD Infrastructure (20-25%)

Automate Windows Virtual Desktop management tasks

The below should cover the following criteria for this section of the exam:
  • In the below steps, it should be noted I am not going to say click this n that, I will give a general overview but you will need to fill in the gaps with your knowledge of Azure. 
  • All opinions below are my own and are not representative of any company I am linked with. 
  • All scripts and information followed below is at your own risk and I hold no responsibility if you run any of it in production without testing in pre-production first.

Configure automation for Windows Virtual Desktop

In the link provided, it talks about using a runbook which essentially shuts down machines based on usage requirements, time of day etc. 

So if your users aren't using the system between say 7pm and 5am, then you might want some form of automation to cover you here to cut down on costs.

If you follow the guide, you should see something like the below:

So I have created a PS1 file within VSC, and I am running through the bits of the script one by one.

I have commented out sections, so that it will use the defaults as per the notes next to the commands.

We can see if I run a Get-AzAutomationAccount in the terminal, we can see its already created itself.

Once finished, itll give me a URI which I need to copy and save for later.

Now, at this stage a global issue with Azure occurred so I couldn't do anything for a bit.

A good place to track the status is:

Anyway, the following day/evening were all good again.

Now we need to Create the logic app and schedule.

I went went the defaults for the most part, I am not overly concerned with a perfect solution, I just want to see the process in action and understand it enough to use it should I need to. 

Now, we can jump into the portal and see what's happening.

In the below screenshot, you can see that the scheduler has failed.

So it turns out, this looks like it might be a bug? or maybe due to the outage part of the script didn't run the webhook location correctly.

In the logic code for the app, it looks like it added an extra "\" which seemed to be confusing the script, so amending this to the below resolved this issue and allowed my script onto the next step.

So we can see the scheduler is now working correctly, what about the jobs themselves?

Hmm it failed...

So turns out, I forgot to add a Run-As account to the automation account!

Account added...

Ok lets try running the job again, remember I set it to run every 15 mins.

Ok, all good, looks like its working now after doing that!

I can check out the details on the job itself, what its doing etc. by clicking on the job itself.

Now, the scripts had a little moan for a few reasons, this being my WVD wasn't switched on (so it switched it on) but as my lab is limited in budget, I don't actually need lots of hosts running, but at least we get to see the automation side of things in action.

So this concludes automation, however there is a lot more to see in the following link, it also covers using reporting issues and log analytics (which I didn't enable).

I am fairly confident that in future revisions, this will be even easier to setup, maybe even a tick box somewhere with options to enter the requirements in via the hostpool section itself, but we will see.


Popular posts from this blog

Day 34: AZ-140 Pt.2.3 - Create Gold Images & Deploy

Day 30: AZ-140 Pt.1 - Planning

Day 33: AZ-140 Pt.2.2 - Create & Configure Hostpools