exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 2 question 31 discussion

Actual exam question from Microsoft's AZ-204
Question #: 31
Topic #: 2
[All AZ-204 Questions]

HOTSPOT -
You are developing an application that needs access to an Azure virtual machine (VM).
The access lifecycle for the application must be associated with the VM service instance.
You need to enable managed identity for the VM.
How should you complete the PowerShell segment? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: -IdentityType -
Enable system-assigned managed identity on an existing Azure VM:
To enable a system-assigned managed identity, use the -IdentityType switch on the Update-AzVM cmdlet (see below).

Box 2: $SystemAssigned -
$vm = Get-AzVM -ResourceGroupName myResourceGroup -Name myVM
Update-AzVM -ResourceGroupName myResourceGroup -VM $vm -IdentityType SystemAssigned
Reference:
https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/qs-configure-powershell-windows-vm

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
agueda
Highly Voted 4 years, 1 month ago
The parameter should be "IdentityType", not "IdentityId" as it's stated in the reference link. "SystemAssigned" is correct
upvoted 82 times
d0bermannn
3 years, 8 months ago
as we see here https://docs.microsoft.com/en-us/powershell/module/az.compute/update-azvm?view=azps-6.2.1 there are both IdentityType and IdentityId parameters for update-azvm
upvoted 3 times
...
zolani
1 year ago
# Enable managed identity for the VM $vmName = "MyVM" $resourceGroupName = "MyResourceGroup" # Set the VM identity type to SystemAssigned Set-AzVM -ResourceGroupName $resourceGroupName -VMName $vmName -AssignIdentity $SystemAssigned # Print a success message Write-Host "Managed identity enabled for VM $vmName in resource group $resourceGroupName."
upvoted 1 times
...
TonyMel
2 years, 1 month ago
correct, in 2023Mar24, score: 904/1000
upvoted 10 times
...
Shadoken
3 years, 5 months ago
I agree agueda. If you see the documentation its mandatory add "-IdentityType" tag. https://docs.microsoft.com/en-us/powershell/module/az.compute/update-azvm?view=azps-6.6.0#syntax
upvoted 2 times
...
...
mlantonis
Highly Voted 3 years, 11 months ago
Box 1: -IdentityType -IdentityType: The type of identity used for the virtual machine. Valid values are SystemAssigned, UserAssigned, SystemAssignedUserAssigned, and None. -IdentityId: Specifies the list of user identities associated with the virtual machine. The user identity references will be ARM resource IDs in the form: Box 2: $SystemAssigned There are two types of managed identities: - System-assigned: Some Azure services allow you to enable a managed identity directly on a service instance. When you enable a system-assigned managed identity an identity is created in Azure AD that is tied to the lifecycle of that service instance. So when the resource is deleted, Azure automatically deletes the identity for you. By design, only that Azure resource can use this identity to request tokens from Azure AD. - User-assigned: You may also create a managed identity as a standalone Azure resource. You can create a user-assigned managed identity and assign it to one or more instances of an Azure service. In the case of user-assigned managed identities, the identity is managed separately from the resources that use it.
upvoted 76 times
edengoforit
3 years, 3 months ago
This answer deserves a top comment
upvoted 1 times
...
mlantonis
3 years, 11 months ago
Reference: https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/qs-configure-powershell-windows-vm https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview#managed-identity-types
upvoted 6 times
...
...
Thameur01
Most Recent 4 weeks, 1 day ago
IdentityType SystemAssigned
upvoted 1 times
...
AryaNiaz
8 months ago
Correct Answer. $vm = Get-AzVM -ResourceGroupName myResourceGroup -Name myVM Update-AzVM -ResourceGroupName myResourceGroup -VM $vm -IdentityType SystemAssigned Reference: https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-to-configure-managed-identities?pivots=qs-configure-powershell-windows-vm#enable-system-assigned-managed-identity-on-an-existing-azure-vm
upvoted 2 times
...
Christian_garcia_martin
8 months, 2 weeks ago
first should be IdentityType , but if you don't have this choice which closely maps to -IdentityType is -AssignIdentity
upvoted 1 times
...
harbox
1 year, 1 month ago
# Login to your Azure account Connect-AzAccount # Specify the resource group and VM name $resourceGroupName = "YourResourceGroup" $vmName = "YourVMName" # Get the VM object $vm = Get-AzVM -ResourceGroupName $resourceGroupName -Name $vmName # Enable system-assigned managed identity $vm = Set-AzVMIdentity -ResourceGroupName $resourceGroupName -VM $vm -AssignIdentity:$SystemAssigned # Update the VM with the managed identity configuration Update-AzVM -ResourceGroupName $resourceGroupName -VM $vm
upvoted 1 times
...
bgbgvfvf
1 year, 4 months ago
Given answer is correc
upvoted 1 times
...
ENGs
1 year, 6 months ago
On my exam 2023-10 before the Update of the Exam
upvoted 1 times
...
p2006
1 year, 7 months ago
https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/qs-configure-powershell-windows-vm#enable-system-assigned-managed-identity-on-an-existing-azure-vm
upvoted 2 times
...
DonH
1 year, 10 months ago
Just for information: I just had this question on my AZ204 exam - 16-jun-2023. I barely made it (with only 767 points) so I can't inform anyony if this answer is correct or not, just stating that this is an actual exam question.
upvoted 3 times
...
tom112
1 year, 11 months ago
<IdentityType> The type of identity used for the virtual machine. Valid values are SystemAssigned, UserAssigned, SystemAssignedUserAssigned, and None. Type: Nullable<T>[ResourceIdentityType] Accepted values: SystemAssigned, UserAssigned, SystemAssignedUserAssigned, None
upvoted 1 times
...
fkaracan
2 years, 2 months ago
since $ states they both are variables. given answer is correct.
upvoted 1 times
...
AllNickNamesTaken
2 years, 2 months ago
Please correct me if I am wrong, but the "The access lifecycle for the application must be associated with the VM service instance" part looks like a red herring. Since it says that the *access* lifecycle must be associated with the service instance and not the *managed identity lifecycle*, then a user assigned identity would work here. Delete the VM and the application has no more access to it. If true, that would make the "IdentityID" parameter correct in this case.
upvoted 1 times
...
70PineApple
2 years, 2 months ago
Got this in exam today..20/02/23 score: 817
upvoted 3 times
...
Priya0703
2 years, 2 months ago
Got this question in exam today on 20-02-2023
upvoted 2 times
...
carlosghosn
2 years, 5 months ago
Got this in the exam today ! Nov 25, 2022
upvoted 1 times
...
micro9000
2 years, 5 months ago
There's no correct option, it should be "IdentityType" https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/qs-configure-powershell-windows-vm#enable-system-assigned-managed-identity-on-an-existing-azure-vm We should update this question and the answer
upvoted 1 times
warchoon
2 years, 2 months ago
I think it's a trick. $SystemAssigned is a variable for ID
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago