Closed craigbeeremct closed 7 months ago
Something like the following:
Open PowerShell 7 as an administrator. This can be done by clicking the Start Menu, typing pwsh, right-clicking on PowerShell 7 (x64) and choosing Run As Administrator. Select Yes at the UAC prompt.
If the PowerShell version is earlier than 7.2 then close the PowerShell 7 window and perform the following step. Otherwise skip to the next section.
Open Microsoft Edge. Navigate to https://aka.ms/PowerShell-Release?tag=v7.3.1. Scroll down to the assets section and select powershell-7.3.1-win-x64.msi. When the download has completed, select Open file. Install using all the defaults.
In the administrative PowerShell 7 window, enter the following.
Install-Module Microsoft.Graph -Scope CurrentUser
If asked to confirm downloading from an untrusted repository then enter y.
Close the administrative PowerShell 7 window.
Open PowerShell 7.
Sign in to Azure by entering the folowing.
Connect-MgGraph -Scopes "User.ReadWrite.All"
When Microsoft Edge opens, sign in as MOD Administrator.
At the Permissions requested page, enable Consent on behalf of your organization and then select Accept.
Close the Microsoft Edge browser tab and return to PowerShell.
Create a password profile object. Replace Pa55w.rdPa55w.rd with a complex password of your choice.
$PWProfile = @{
Password = "Pa55w.rdPa55w.rd";
ForceChangePasswordNextSignIn = $false
}
Create a user. Replace labtenantname.com with the .onmicrosoft.com name assigned to your tenant.
New-MgUser `
-DisplayName "Rene Magi" `
-GivenName "Rene" -Surname "Magi" `
-MailNickname "renemagi" `
-UsageLocation "NZ" `
-UserPrincipalName "rene@labtenantname.com" `
-PasswordProfile $PWProfile -AccountEnabled `
-Department "Research" -JobTitle "Subject Matter Expert"
From https://techcommunity.microsoft.com/t5/microsoft-entra-azure-ad-blog/microsoft-entra-change-announcements-september-2022-train/ba-p/2967454#:~:text=for%20Header%20keys.-,Azure%20AD%20Graph%20API,-Azure%20AD%20Graph
All references to those cmdlets will need to be updated to the new cmdlets (for example New-MgUser).