To get up and running quickly, here's what I did. For best security, you should totally check the docs if you aren't sure if this is safe ;)
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
Install-Module AzureADPreview
Install-Module MSOnline
It will not hurt anything to have all three of these modules installed alongside one another.
Having managed over 45K users in Google Workspace, I can definitively say Microsoft is the only large productivity suite provider that cares about IT admins by providing good tooling ;)
Let's create a user with the Azure Az Powershell module.
Now lets look at how to get user details in each module.
My primary 3 uses for Get commands are to view user details (usually troubleshooting), search users and filter (Get-* | Where-Object...), and get an object to pipe into another command (Get-* | Where-Object {...} | Set-*).
Az Azure module:
Get-AzADUser -UserPrincipalName tuser1@domain.onmicrosoft.com
Update-AzADUser is limited compared to the other two. That's why I'd suggest comparing all three and seeing which is the right tool for the job.
Keep an eye on Az modules - changes fast
Not sure if anyone will notice, but as I was playing with the modules, I tabbed through the options for UserType and discovered something I've never seen before.
Anyone know what a "viral" user type is?
Whatever it is, it doesn't sounds good, and I changed Test User Three to it
The last main function that I'll cover is deleting users.
Again, the commands are too long for Twitter, but you can find them all over on the repo:
I think the most common misunderstanding of Conditional Access is its relationship to authentication, and this results in not understanding how the rest of the controls actually work
Conditional Access performs authorization by evaluating tokens from the authentication service
This provides important insights 💡
CA policies cannot block anything until AFTER authentication occurs
This means CA cannot help with password spray/credential stuffing. This is why we have Password Protection and Smart Lockout.
You likely aren't collecting all available events to the Unified Audit Log
First, not all events are enabled or retained optimally. Consider creating this policy in the Purview portal (leave users and record types blank to collect everything).
Retention is based on license...
This policy only applies to users with the Microsoft 365 Advanced Audit SKU assigned, audit records are retained for 1 year. Audit records for users without this SKU are retained for 180 days (thanks CISA for the bump up from 90 days!)
Second, this still doesn't get everything..
Next we have to enable all the records for mailbox auditing
But wait, Microsoft totally pinky promises that you don't need to manage these records because they enable them for you
So we create a security group named "Salesforce Admins" and add our admins to the group
Then we configure the claims rule in our Identity Provider to send the role value of System Administrator for members of a group with the display name of "Salesforce Admin" 🚩
Unfortunately, display names are almost never unique, so anyone that can create or modify a group to match the display name can now add admins by adding them to this group
In Entra, ANYONE can create a group by default or owners of groups can modify them, no admin roles needed