Create Virtual Machine in Azure using Azure CLI | Exam AZ-900 Solution

Create 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 PowerShell, 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.

A

The command can be run from PowerShell or the command prompt if you have the Azure CLI installed.

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

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

The solution suggests installing the Azure CLI (Command-Line Interface) on a computer that runs Windows 10. Azure CLI is a command-line tool that enables you to manage Azure resources from the command prompt or PowerShell. It provides a set of commands for interacting with Azure resources, including creating and managing virtual machines.

After installing Azure CLI, the solution recommends signing in to Azure using PowerShell. This step ensures that you have the necessary authentication and permissions to perform actions in your Azure subscription.

Once you are signed in to Azure, you can run the given command to create the virtual machine named VM1. The command specifies the following parameters:

  • --resource-group RG1: Specifies the resource group where the virtual machine will be created, which is RG1 in this case.
  • --name VM1: Specifies the name of the virtual machine, which is VM1 in this case.
  • --image UbuntuLTS: Specifies the image to be used for the virtual machine, which is UbuntuLTS (Ubuntu Linux distribution) in this case.
  • --generate-ssh-keys: Generates SSH keys for the virtual machine, allowing secure remote access.

By following the provided solution and executing the command in PowerShell after signing in to Azure, you will create the virtual machine VM1 in the Subscription1 Azure subscription within the RG1 resource group.

Therefore, the answer is A. Yes, the solution meets the goal.

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

The command given in the scenario creates a virtual machine in the resource group named RG1 with the UbuntuLTS image and generates SSH keys. To create VM1 in Subscription1 using this command, you need to ensure that you are signed in to the correct Azure subscription and have access to the required resources.

The proposed solution suggests installing Azure CLI on a Windows 10 computer and then signing in to Azure using PowerShell. Azure CLI is a command-line interface that allows you to manage Azure resources using commands. Installing Azure CLI on a computer running Windows 10 allows you to use PowerShell to run the command to create VM1 in Subscription1.

To sign in to Azure using PowerShell, you can use the Connect-AzAccount cmdlet. This cmdlet prompts you to enter your Azure credentials and then signs you in to your Azure account. Once you are signed in, you can run the az vm create command to create VM1 in Subscription1.

Therefore, the proposed solution is a valid approach to creating VM1 in Subscription1 using the provided Azure CLI command.