exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 4 question 20 discussion

Actual exam question from Microsoft's AZ-204
Question #: 20
Topic #: 4
[All AZ-204 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 develop Azure solutions.
You must grant a virtual machine (VM) access to specific resource groups in Azure Resource Manager.
You need to obtain an Azure Resource Manager access token.
Solution: Run the Invoke-RestMethod cmdlet to make a request to the local managed identity for Azure resources endpoint.
Does the solution 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
mlantonis
Highly Voted 4 years ago
Correct Answer: Yes Using the Invoke-WebRequest cmdlet, make a request to the local managed identity for Azure resources endpoint to get an access token for Azure Resource Manager. I believe we can you Invoke-RestMethod too. https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-arm
upvoted 32 times
...
princesskay
Highly Voted 4 years, 9 months ago
This does make sense since a web-request can be a rest call! In the link below, it explains how web-request supports HTML content while Rest-Method supports JSON and XML content. The link provided for the solution is correct as well. https://superuser.com/questions/1235349/what-is-the-difference-between-invoke-webrequest-and-invoke-restmethod
upvoted 25 times
...
Vichu_1607
Most Recent 8 months ago
Selected Answer: A
Yes, the solution does meet the goal. The Invoke-RestMethod cmdlet can be used to make a request to the local managed identity for Azure resources endpoint (http://169.254.169.254/metadata/identity/oauth2/token). This endpoint can provide an Azure Resource Manager access token when called from an Azure VM with a managed identity enabled. This token can then be used to authenticate to the Azure Resource Manager API.
upvoted 3 times
overhill
7 months, 2 weeks ago
Strong as usual
upvoted 1 times
...
...
carlosghosn
2 years, 6 months ago
Got this in the exam today ! Nov 25, 2022
upvoted 2 times
...
OPT_001122
2 years, 7 months ago
Selected Answer: A
Answer: Yes
upvoted 1 times
...
Mousavi
2 years, 9 months ago
Selected Answer: A
Absolutely the corrct answer is A
upvoted 2 times
...
Perplex
2 years, 11 months ago
Selected Answer: A
Answer A - The 2 most upvoted comments say this is correct and they are right.
upvoted 3 times
...
Azprep
3 years, 2 months ago
Answer is Yes
upvoted 2 times
...
SivajiTheBoss
3 years, 3 months ago
Selected Answer: B
Need to use Invoke-WebRequest cmdlet not Invoke-RestMethod Correct Answer: B Get an access token using the VM's system-assigned managed identity and use it to call Azure Resource Manager You will need to use PowerShell in this portion. 1. In the portal, navigate to Virtual Machines and go to your Windows virtual machine and in the Overview, click Connect. 2. Enter in your Username and Password for which you added when you created the Windows VM. 3. Now that you have created a Remote Desktop Connection with the virtual machine, open PowerShell in the remote session. 4. Using the Invoke-WebRequest cmdlet, make a request to the local managed identity for Azure resources endpoint to get an access token for Azure Resource Manager. Example: $response = Invoke-WebRequest -Uri 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https:// management.azure.com/' -Method GET -Headers @{Metadata="true"} Reference: https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-arm
upvoted 1 times
...
mabusalma
3 years, 4 months ago
Selected Answer: A
The answer is Yes correct Invoke-WebRequest or Invoke-RestMethod will do the same job but the response in RestMethod will be much simpler.
upvoted 3 times
...
LauraGF
3 years, 9 months ago
The answer is no Invoke-RestMethod: Grant your VM access to a secret stored in a Key Vault https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-nonaad Invoke-WebRequest: Grant your VM access to a Resource Group in Azure Resource Manager https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-arm
upvoted 3 times
...
kondapaturi
3 years, 11 months ago
Answer is YES, you can make use of the PowerShell commands to make a request to managed identity service of the virtual machine. The Invoke-RestMethod is a generic call that is available in PowerShell for making a call to a web service.
upvoted 4 times
...
Spooky7
4 years ago
In order to grant VM access to ARM you need to: - assign VM user/system managed identity - configure permission to ARM for that identity - and then you can access token by Invoke-WebRequest cmdlet and use to to authenticate in ARM. There is nothing in the question which indicates that those 2 previous steps are already done, so I would say it is not a correct answer.
upvoted 4 times
...
glam
4 years, 1 month ago
A. Yes
upvoted 2 times
...
clarionprogrammer
4 years, 2 months ago
A. Yes Invoke-RestMethod is merely a rapper commandlet around Invoke-WebRequest.
upvoted 2 times
ferut
4 years ago
roflol... do you mean wrapper?
upvoted 2 times
businesskasper
4 years ago
I'm pretty sure its a rapper cmdlet
upvoted 1 times
...
...
...
Santileo
4 years, 2 months ago
I code in powershell regularly and Invoke-RestMethod is the correct one to fetch these tokens.
upvoted 4 times
...
kwaazaar
4 years, 2 months ago
Where does it say the code is running on the VM itself?
upvoted 1 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 ...