Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
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 (?) , you can switch to a simple comment.
Switch to a voting comment New
Bobby_Popa
Highly Voted 4 years, 10 months ago
you can run your Bash, and Azure CLI commands in the PowerShell console. It supports both!
upvoted 85 times
Urpiano
3 years, 8 months 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
1 year, 8 months ago
Good thing the question didn't ask you about command prompt commands
upvoted 6 times
...
...
Safwan5
1 year 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 4 years, 9 months ago
Powershell support both Azure cli and powershell commands
upvoted 24 times
Ansible
3 years, 3 months ago
Its not PowerShell but CloudShell Support both Azure CLI and PowerShell Commands
upvoted 28 times
kelvintoys93
3 years, 1 month 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, 7 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
...
...
...
NoursBear
Most Recent 1 month 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
1 month, 1 week ago
Selected Answer: A
it make sense
upvoted 1 times
...
NoursBear
2 months, 2 weeks ago
See question 195
upvoted 1 times
...
Mole857
5 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
6 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 4 times
...
linux_admin
6 months, 4 weeks ago
Selected Answer: B
The given command is written for Azure CLI, not PowerShell.
upvoted 1 times
...
shadhussain12
8 months 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
10 months, 1 week ago
Selected Answer: A
I tried it and it works!
upvoted 10 times
...
fruade
12 months ago
Tested in the Azure cloud shell, a virtual machine was created.
upvoted 12 times
Yomzie
6 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 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 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 1 times
...
PeterV72
1 year ago
Not a fan of how MS words this question, but yes it can be done.
upvoted 1 times
...
SNBose
1 year ago
Selected Answer: B
No, the provided solution does not meet the goal. Launching Azure Cloud Shell from the Azure portal and selecting PowerShell is the correct step to use the Azure CLI, but the Azure CLI command provided in the question is for creating a virtual machine using the Azure CLI, not PowerShell. To create VM1 in Subscription1 using the provided Azure CLI command, you should: Launch Azure Cloud Shell from the Azure portal. Select the Bash environment (not PowerShell) because the Azure CLI commands are typically run in a Bash shell. Run the provided Azure CLI command: bash Copy code az vm create --resource-group RG1 --name VM1 --image UbuntuLTS --generate-ssh-keys This will create VM1 in the RG1 resource group within Subscription1 using the Azure CLI in a Bash environment, which is the appropriate way to execute the given Azure CLI command.
upvoted 2 times
...
Alif3
1 year, 1 month ago
Running the command in Azure Cloud Shell, whether in PowerShell or Bash, does not change the context or the subscription where the resources will be created. By default, the Azure Cloud Shell will use the default subscription associated with your Azure account, not necessarily Subscription1. To ensure that VM1 is created in Subscription1 using the provided command, you should either: Set the Subscription Context: You can use the az account set --subscription command to set the subscription context before running the az vm create command
upvoted 2 times
...
Rini1702
1 year, 1 month ago
BASH COMMAND: az vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --admin-username myUsername --generate-ssh-keys POWERSHELL COMMAND: New-AzVm -ResourceGroupName myResourceGroup -Name myVM -Image UbuntuLTS -AdminUsername myUsername -GenerateSshKeys
upvoted 4 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 ...