Comments on: The Importance of Standardizing Microsoft 365 Account Creation https://practical365.com/azure-ad-account-creation-standardization/ Practical Office 365 News, Tips, and Tutorials Mon, 03 Jun 2024 15:57:33 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_286137'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_286137"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/azure-ad-account-creation-standardization/#comment-286137 Mon, 22 Jan 2024 11:00:48 +0000 https://practical365.com/?p=57836#comment-286137 In reply to Harry.

The Graph SDK doesn’t support per-user MFA assignment. Use a conditional access policy instead and make sure that the users are included within the scope of the policy. https://practical365.com/conditional-access-policies-powershell/

]]>
By: Harry https://practical365.com/azure-ad-account-creation-standardization/#comment-286132 Mon, 22 Jan 2024 09:26:56 +0000 https://practical365.com/?p=57836#comment-286132 Hi sir,

Thanks for your quick reply. while running this script MFA not enabled sir. How to enable MFA for few users (per-user).

#MFA
}
$Users | ForEach-Object {
New-MgUserAuthenticationPhoneMethod -UserId $_.UPN -phoneType “mobile” -phoneNumber $_.Mobilephone
If($?)
{
Write-Host $_.UPN “Success” -ForegroundColor Green
} Else
{
Write-Host $_.UPN “Error” -ForegroundColor Red
}
}

]]>
By: <div class="apbct-real-user-wrapper"> <div class="apbct-real-user-author-name">Tony Redmond</div> <div class="apbct-real-user-badge" onmouseover=" let popup = document.getElementById('apbct_trp_comment_id_285889'); popup.style.display = 'inline-flex'; "> <div class="apbct-real-user-popup" id="apbct_trp_comment_id_285889"> <div class="apbct-real-user-title"> <p class="apbct-real-user-popup-header">The Real Person!</p> <p class="apbct-real-user-popup-text">Author <b>Tony Redmond</b> acts as a real person and passed all tests against spambots. Anti-Spam by CleanTalk.</p> </div> </div> </div> </div> https://practical365.com/azure-ad-account-creation-standardization/#comment-285889 Thu, 18 Jan 2024 13:09:33 +0000 https://practical365.com/?p=57836#comment-285889 In reply to Harry.

Why are you using AzureAD cmdlets to add people to groups? You can do that perfectly well with the Graph SDK. https://office365itpros.com/2022/03/29/create-entra-id-group/

]]>
By: Harry https://practical365.com/azure-ad-account-creation-standardization/#comment-285887 Thu, 18 Jan 2024 12:47:22 +0000 https://practical365.com/?p=57836#comment-285887 Hi Sir,

I am using below script for creating users and adding MFA and groups at a time. But MFA and group part not working. Please guide me sir.
Install-Module Microsoft.Graph
Import-Module Microsoft.Graph.Users
Import-Module Microsoft.Graph.Groups
Connect-MgGraph -Scopes User.ReadWrite.All,Group.ReadWrite.All,Organization.Read.All,Directory.ReadWrite.All, UserAuthenticationMethod.ReadWrite.All, User.ReadWrite.All -NoWelcome
$Users = Import-Csv C:\newuser.csv
$Users | ForEach-Object {$PasswordProfile = @{
Password = $_.Password
}
New-MgUser -DisplayName $_.DisplayName -PasswordProfile $PasswordProfile -AccountEnabled -MailNickName $_.mailNickname -UserPrincipalName $_.UPN -JobTitle $_.Jobtitle -EmployeeHireDate $_.Employeehiredate -UsageLocation $_.UsageLocation -Country $_.Country -GivenName $_.firstname -Surname $_.Surname -EmployeeId $_.Employeeid -Department $_.Department -MobilePhone $_.Mobilephone -City $_.City -PostalCode $_.postalcode
#Assign Lisenses to users
$EmsSku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq $_.license
$addLicenses = @(
@{SkuId = $EmsSku.SkuId
}
)
Set-MgUserLicense -UserID $_.UPN -AddLicenses $addLicenses -RemoveLicenses @()
If($?)
{
Write-Host $_.UPN “Success” -ForegroundColor Green
} Else
{
Write-Host $_.UPN “Error” -ForegroundColor Red
}
#MFA
}
$Users | ForEach-Object {
New-MgUserAuthenticationPhoneMethod -UserId $_.UPN -phoneType “mobile” -phoneNumber $_.Mobilephone
If($?)
{
Write-Host $_.UPN “Success” -ForegroundColor Green
} Else
{
Write-Host $_.UPN “Error” -ForegroundColor Red
}
}

#Install-Module AzureAD
Connect-AzureAD
$Users | ForEach{$Manager = (get-AzureADuser -ObjectId $_.Manager).ObjectId
$gmember = (get-AzureADuser -ObjectId $_.UPN).ObjectId
Set-AzureADUserManager -ObjectId $_.UPN -RefObjectId $Manager
Add-AzureADGroupMember -ObjectId “group ID” -RefObjectId $gmember
Add-AzureADGroupMember -ObjectId “group ID” -RefObjectId $gmember}
Disconnect-MgGraph
Disconnect-AzureAD

]]>