SC-300 · Question #257
Drag and Drop Question You have an Azure subscription that is linked to an Azure AD tenant named contoso.com. The subscription contains a group named Group1 and a virtual machine named VM1. You need…
The correct answer is Get-AzVM; Get-AzADServicePrincipal; Get-AzADGroup. The correct sequence uses Get-AzVM to retrieve the VM object (so you can enable the system-assigned managed identity and update it with Update-AzVM), then Get-AzADServicePrincipal to retrieve the service principal that is automatically created when the managed identity is…
Question
Drag and Drop Question You have an Azure subscription that is linked to an Azure AD tenant named contoso.com. The subscription contains a group named Group1 and a virtual machine named VM1. You need to meet the following requirements:
- Enable a system-assigned managed identity for VM1.
- Add VM1 to Group1.
How should you complete the PowerShell script? To answer, drag the appropriate cmdlets to the correct targets. Each cmdlet may be used once, more than once or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point. Answer:
Answer Area
Drag items
Correct arrangement
- Get-AzVM
- Get-AzADServicePrincipal
- Get-AzADGroup
Explanation
The correct sequence uses Get-AzVM to retrieve the VM object (so you can enable the system-assigned managed identity and update it with Update-AzVM), then Get-AzADServicePrincipal to retrieve the service principal that is automatically created when the managed identity is enabled (the VM's identity in Azure AD), and finally Get-AzADGroup to retrieve Group1 so its ObjectId can be used with Add-AzADGroupMember to add the VM's service principal to the group. This workflow is necessary because managed identities are represented as service principals in Azure AD, and adding a VM to an Azure AD group requires referencing that service principal object.
Topics
Community Discussion
No community discussion yet for this question.