Create a Virtual Machine in Azure using Azure CLI | Exam AZ-900: Microsoft Azure Fundamentals

Create a Virtual Machine in Azure using Azure CLI

Prev Question Next Question

Question

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.

After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.

You have an Azure subscription named Subscription1. You sign in to the Azure portal and create a resource group named RG1.

From Azure documentation, you have the following command that creates a virtual machine named VM1. az vm create --resource-group RG1 --name VM1 --image UbuntuLTS

--generate-ssh-keys

You need to create VM1 in Subscription1 by using the command.

Solution: From a computer that runs Windows 10, install Azure CLI. From a command prompt, sign in to Azure and then run the command.

Does this meet the goal?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B.

B

The command can be run from PowerShell or the command prompt if you have the Azure CLI installed. However, it must be run on the Windows 10 computer, not in Azure.

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest

Yes, the solution meets the goal of creating a virtual machine named VM1 in Subscription1 using the provided Azure CLI command.

The solution proposes to install Azure CLI on a computer running Windows 10 and then run the command to create a virtual machine. Azure CLI is a command-line tool that allows you to manage Azure resources from your local computer.

To use Azure CLI, you need to first authenticate with your Azure account. This can be done by signing in to Azure using the az login command. Once you are authenticated, you can use the az vm create command with the provided parameters to create a virtual machine named VM1 in the resource group RG1 in Subscription1.

The --resource-group parameter specifies the name of the resource group where the virtual machine will be created. In this case, it is set to RG1, which is the resource group that has already been created in the subscription.

The --name parameter specifies the name of the virtual machine that will be created. In this case, it is set to VM1.

The --image parameter specifies the image that will be used to create the virtual machine. In this case, it is set to UbuntuLTS, which is a commonly used Ubuntu image in Azure.

The --generate-ssh-keys parameter generates SSH keys that are used for authentication to the virtual machine.

Therefore, the proposed solution meets the goal of creating a virtual machine named VM1 in Subscription1 by using the provided Azure CLI command.