Azure Exams and Performance-Based Testing – How to create a VM without knowing PowerShell or CLI

Overview

Recently, there’s been a lot of focus on the new Azure exams (with good reason, since all of the “current” exams/certifications expiring due to this, causing everyone to re-certify just to maintain their certifications and/or organization’s partner competency status).

When the exams first came out (starting with the AZ-100 series, comprising of AZ-100 “Microsoft Azure Infrastructure and Deployment” and AZ-101 “Microsoft Azure Integration and Security”), I wrote them in beta. This also applies to the AZ-300 series exams for Azure Solution Architects. This means, although Microsoft stated that performance-based questions would be present, I didn’t actually encounter any.

However, many individuals that I’ve talked to, have experienced the performance-based testing on the exam. In a nutshell, it puts you into the actual Azure portal and gives you a list of tasks to complete (ie. create a Virtual Machine with specific settings).

Now, when Microsoft first came out with the performance-based testing, the only option for completing the given tasks, was through the GUI/UI of the portal itself. However, Microsoft did indicate that at a later date, they would provide more options for completing the tasks (ie. via PowerShell or CLI), so that those who were more comfortable with these methods could use them.

 

The Challenge

But, that’s not entirely accurate. In fact, Microsoft changed its approach to the performance-based testing, and now (based on other individual’s experiences) enforce which method you are required to use to complete the tasks.

This means you will be given a task to complete (ie. create a Virtual Machine with specific settings), but you will be told explicitly to use PowerShell or CLI, not the portal!

 

Agree to Disagree

While I am all for being familiar with scripting and automating the creation of objects in Azure, I personally disagree that Microsoft should enforce the exact method or tools to use to complete an assigned task.

For example, you can create an Azure VM through the following ways:

  • Portal UI
  • PowerShell (and at that, either with the former AzureRM cmdlets, or the new AZ cmdlets)
  • Command-Line Interface (CLI)
  • Azure Resource Manager (ARM) templates
  • Terraform
  • Ansible

All of these tools (and more) are available at your disposal to use. The fact that you use the portal vs something like, say Terraform, doesn’t change the actual results of the outcome. You still end up with a Virtual Machine with the specified settings.

So in my opinion, it’s wrong for Microsoft to enforce a specific method/tool to complete the task, especially in an exam. I mean, seriously, how many of us experienced IT Pros can type-out a full complete PowerShell command from memory? Sure, maybe a few, but definitely not everyone. And another point, isn’t Microsoft supposed to be shifting to this new performance-based testing method to get away from people just memorizing answers?

 

Moving On

With that all in mind, and my mini-rant over, I wanted to take a little time to help everyone prepare for this inevitable future when taking the new Azure exams.

I’ve heard from some, if they were writing an exam, and were placed in the Azure portal but told to create, say a VM, only through PowerShell, that they would have to skip the question.

So that’s the goal of this article, to give you some guidance and tips to help you along your way.

 

The PowerShell Way

Let’s assume you’re new to PowerShell, but perhaps have a general understanding about it. But, like most people, you don’t have cmdlets memorized.

Assuming that we are being “asked” (aka told) to use PowerShell to create a VM, where would you start? Well, without experiencing this type of testing myself, I would like to assume that we are placed in the Azure Cloud Shell versus some sort of desktop PowerShell prompt.

So, if we’re in Azure Cloud Shell, the first thing we can do is type ‘help’, and we will see some useful examples of commands we can use. Notice the 3rd example ‘Get-AzCommand’.

Azure Cloud Shell – Help Output

If we type Get-AzCommand and press Enter, we see an output of all the cmdlets available, and the good news is that it’s all sorted alphabetically! If we look down the list, we can see all of the cmdlets related to Azure.Compute (which is what we need, if we’re going to create a VM). The one we will need (without getting into the details of the other cmdlets yet), is New-AzVM.

Azure Cloud Shell – Get-AzCommand

Now, if you were to just type New-AzVM and press Enter, you would receive 3 promtps, one for the VM Name, another for the UserName, and a third for the Password. Then, PowerShell would go off and create the VM for you. Notice, that it’s also automatically creating other objects like Virtual Networks (VNets), Network Security Groups (NSGs), Public IP Address (PIP), etc.

While this is great, it might not be what you need. You may have specific instructions on what the VNet should be called (whether you have to create it or not), the OS Type (ie. Windows or Linux), the VM Class/SKU, etc.

Azure Cloud Shell – New-AzVM – No Config

 

Help is on the way

OK so, if we use the PowerShell help system, we can type Help New-AzVM, to get us a little further. Not only do we get to see the syntax, and parameter details/descriptions, if you scroll down far enough, you will see…. examples! And not just simple examples, examples that include creating a virtual machine from a custom user image, or creating a VM from a marketplace image without a Public IP.

Azure Cloud Shell – New-AzVM – Help Output

To speed things up, you can use the same ‘Help New-AzVM’ cmdlet, and append ‘-examples’ to just see the examples output.

 

Makeshift Notepad

Now, while you’re exploring the syntax and examples of the cmdlets, you’ll probably want to keep the examples somewhere in order to modify them as instructed. But, some testing environments do not allow the use of Notepad, so what will you do?

On the command-line, type ‘. code’ and press Enter. This will bring up the inline code editor (which is based on VS Code), where you can edit, and save the files you are working on. This will give you a place to work more easily until you’re ready to run your PowerShell code to complete your assigned tasks.

Azure Cloud Shell – Code Editor

 

Going -Full Cmdlet

The final tip I have for you, if you’re not sure how to accomplish your task in PowerShell, is to use the -Full option. By this I mean, when you’re trying to look at the help file for the cmdlet, include -Full on the end (like we included the -Examples option to only list the examples).

Sometimes there may be additional information in the cmdlet helpfile that could be useful for you to know, depending on what your task(s) are.

 

The CLI Way

All of the above-mentioned approaches for help, examples, etc. also work in Azure CLI, although it might be slightly different.

I would recommend that you practice navigating the cmdlets and how to access the help files for both so that when you’re under pressure during the exam, it won’t be quite as stressful.

 

Conclusion

Even if you are not fully comfortable with PowerShell or the CLI, you can at least use the help system if you get stuck and are unsure of the exact syntax or property to use.

Hopefully, this has provided some good suggestions and guidance for when you prepare to write any of the new Azure exams that include performance-based testing.

%d bloggers like this: