can you generate a powershell script to change the mail field in azure active directory?
- User
can you generate a powershell script to change the mail field in azure active directory?
Assistant
Here is a PowerShell script to change the mail field in Azure Active Directory:
# Connect to Azure AD with an account that has permissions Connect-AzureAD # Get the user you want to update $user = Get-AzureADUser -ObjectId "user@domain.com" # Set the new email address $user.Mail = "newemail@domain.com" # Save the changes Set-AzureADUser -ObjectId $user.ObjectId -DisplayName $user.DisplayName -Mail $user.MailTo connect, you need an account with permissions to update users in Azure AD.
The key steps are:
- Connect to Azure AD with
Connect-AzureAD - Get the user you want to update with
Get-AzureADUser - Change the
Mailproperty to the new email address - Save the changes with
Set-AzureADUser
Let me know if you have any other questions!
- Connect to Azure AD with
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.