Home / Microsoft / AZ-100 / Question 110

Prev Question
Next Question

Question 110

Due to a recent corporate reorganization, team members in the Accounting department are now part of the Finance department.

You need to change the Department property for 36 Azure AD user accounts. Your solution must minimize administrative effort and make future bulk updates easier to perform.

What should you do?




You should write a PowerShell script using the AzureAD module. Your script should call Connect-AzureAD to authenticate as an administrator, enumerate a list of appropriate group members, and then use a looping construct to update the Department property for the group members. For instance, your script may look like the following:


$groupName = Get-AzureADGroup -SearchString 'Accounting'

$users = Get-AzureADGroupMember -ObjectId $groupName.ObjectId

foreach ($u in $users) {

Set-AzureADUser -ObjectId $u.Mail -Department 'Finance'


Going beyond this scenario's requirements, you will likely need to rename the Accounting group to Finance as well for consistency's sake.

You should not write a PowerShell workflow using the MSOnline module and a CSV file containing the relevant usernames. First, MSOnline is a legacy Azure Active Directory module and Microsoft strongly encourages customers to use the AzureAD module instead. Second, importing a CSV file is an excellent way to bulk-add new objects into AzureAD but is not appropriate for this bulk update scenario.

You should not write a DSC script and deploy it using Azure Automation. DSC is used to prevent configuration drift in target systems, not to perform bulk updates to a directory service.

You should not write a PowerShell Azure Function using the AzureRM.Profile module. The AzureRM.Profile module contains cmdlets concerning authentication and user context, not Azure Active Directory itself.



Load more
Prev Question
Next Question