exam questions

Exam AZ-900 All Questions

View all questions & answers for the AZ-900 exam

Exam AZ-900 topic 1 question 184 discussion

Actual exam question from Microsoft's AZ-900
Question #: 184
Topic #: 1
[All AZ-900 Questions]

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 the Azure portal, launch Azure Cloud Shell and select PowerShell. Run the command in Cloud Shell.
Does this meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Bobby_Popa
Highly Voted 5 years, 3 months ago
you can run your Bash, and Azure CLI commands in the PowerShell console. It supports both!
upvoted 85 times
Urpiano
4 years, 1 month ago
I suppose it's correct but launching CMD commands from PowerShell can works or not, it depends how the CMD command works. Sometimes it's necessary to do suplementary actions: https://www.powershellmagazine.com/2013/01/02/calling-native-commands-from-powershell/ https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx?PageIndex=3 https://4sysops.com/archives/use-powershell-to-execute-an-exe/ Don't know if this Command Shell line can be executed successfuly on PowerShell, and can test it :-(
upvoted 2 times
RougePotatoe
2 years, 1 month ago
Good thing the question didn't ask you about command prompt commands
upvoted 6 times
...
...
Safwan5
1 year, 5 months ago
You can run bash commands in powershell yes, but technically you'd be running them from the bash shell within powershell.
upvoted 1 times
...
...
DBoss
Highly Voted 5 years, 2 months ago
Powershell support both Azure cli and powershell commands
upvoted 24 times
Ansible
3 years, 8 months ago
Its not PowerShell but CloudShell Support both Azure CLI and PowerShell Commands
upvoted 28 times
kelvintoys93
3 years, 6 months ago
But the question mentioned that PowerShell is selected in CloudShell. You sure it works with the command line, with ubuntu image?
upvoted 3 times
...
NavShett
2 years, 12 months ago
If I remember there was another question where CMD and MS Powershell was run from Windows Desktop, and that too allowed Azure CLI commands to operate.
upvoted 1 times
...
...
...
Dmarcetic
Most Recent 3 weeks, 6 days ago
Selected Answer: B
"az vm create" is CLI not PowerShell command
upvoted 1 times
...
Chiquitabandita
1 month, 2 weeks ago
Selected Answer: A
To create an Azure VM with the Azure CLI in PowerShell and generate SSH keys automatically, you can use the following command: Code az vm create --resource-group RG1 --name VM1 --image UbuntuLTS --generate-ssh-keys This command will: Create a VM named "VM1": in the resource group "RG1". Use the Ubuntu LTS image: for the VM. Generate an SSH key pair: and use it for authentication. The public key will be added to the VM, and the private key will be stored locally on your machine.
upvoted 1 times
...
Mahendranath_G
2 months, 3 weeks ago
Selected Answer: B
the provided script is CLI, not a powershell script hence the answer is NO
upvoted 1 times
...
Pablii
2 months, 4 weeks ago
Selected Answer: B
The location is missing in the command line
upvoted 1 times
...
NoursBear
6 months ago
https://learn.microsoft.com/en-us/cli/azure/get-started-tutorial-2-environment-syntax?tabs=Bash#:~:text=Azure%20CLI%20commands%20can%20be,shell%20(Cmd)%20scripting%20languages
upvoted 1 times
...
Nathan12345
6 months, 1 week ago
Selected Answer: A
it make sense
upvoted 1 times
...
NoursBear
7 months, 2 weeks ago
See question 195
upvoted 1 times
...
Mole857
10 months, 3 weeks ago
CLI and powershell commands are different. This code will only run in an Azure CLI environment, ie Bash
upvoted 3 times
...
Yomzie
11 months, 3 weeks ago
This script: az vm create --resource-group RG1 --name VM1 --image UbuntuLTS --generate-ssh-keys, is a BASH script. The equivalent PowerShell script would be: New-AzVm -ResourceGroupName myResourceGroup -Name myVM -Image UbuntuLTS -AdminUsername myUsername -GenerateSshKeys So, the answer is "NO", because the instruction mentioned "...launch Azure Cloud Shell; Select PowerShell..." which would result in an error when you run the Bash Cmd inside the PowerShell window.
upvoted 5 times
...
linux_admin
11 months, 4 weeks ago
Selected Answer: B
The given command is written for Azure CLI, not PowerShell.
upvoted 1 times
...
shadhussain12
1 year ago
The answer is no. The given command is an example of Azure CLI. The question prompt states that the user selects PowerShell in the Azure Cloud Shell. In order to run this command, the user must translate it to the equivalent PowerShell syntax. Therefore the answer is No.
upvoted 3 times
...
imransh
1 year, 3 months ago
Selected Answer: A
I tried it and it works!
upvoted 11 times
...
fruade
1 year, 4 months ago
Tested in the Azure cloud shell, a virtual machine was created.
upvoted 12 times
Yomzie
11 months, 3 weeks ago
It's a lie!! The provided Bash command: az vm create --resource-group RG1 --name VM1 --image UbuntuLTS --generate-ssh-keys ...will not work directly in a PowerShell environment without modification. In PowerShell, the syntax for command-line arguments, variables, and other features differs from Bash. Additionally, Azure CLI commands themselves are specific to Bash syntax and would need to be translated or adapted to PowerShell syntax for them to work correctly in a PowerShell environment. For example, to make the above command work in PowerShell, it would have to be written in TWO double-quotes like this: az "vm create --resource-group RG1 --name VM1 --image UbuntuLTS --generate-ssh-keys" Note: To use Azure CLI commands in PowerShell, you would typically run them using the az command followed by the Azure CLI command as a string. The 'az' comes before the " " containing the vm create... statement
upvoted 1 times
...
...
Safwan5
1 year, 5 months ago
I think the way these questions are formed has made some of us paranoyed that we complicate things so much :D. Simply... Bash commands and powershell commands are distinct, which is the reason why Windows OS is different from a Linux or Mac OS. The command porvided is an azure bash command, the equivelant for powershell would be like: New-AzVm _____blabla______ if you have basic familiarity with bosh shells, you can easily tell that powershell isn't meant for this command. If the question stopped at opening the Azure cloud shell witheout specifying "powershell" then it would be a valid soluction, but since PS is mentioned, answer is NO !!
upvoted 3 times
...
SAFM
1 year, 5 months ago
Selected Answer: B
I vote "No" because I see that Bash can run correctly in Azure CLI but not in Power shell: https://learn.microsoft.com/en-us/cli/azure/choose-the-right-azure-command-line-tool
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago