PowerShell – nullify extension attributes for all users in AAD using Graph API

Extensions attributes in AAD are a great way to store any auxiliary information that does not belong in any other user properties. The only sad part, it's only 15 of them and they are text fields. If you ever need to clear some or all of them, the script below will be a great help! Benefits of the script: makes changes in batches - only takes seconds to run; dry or wet run depending on the switch (see the important note below). This script uses an App-only access rather than Delegated access unlike my other script ( https://365basics.com/powershell-find-and-update-a-string-value-within-all-dynamic-group-membership-rules/ ). If you would like to learn more - https://learn.microsoft.com/en-us/graph/auth/auth-concepts/ Important! This line (#116) of code is responsible for either dry or wet run of the script. I left it commented on purpose and by default. # $UserAdjustments = Invoke-RestMethod @Parameters Technically, you can adjust this script to clear and/or populate any user attributes. #…

Continue ReadingPowerShell – nullify extension attributes for all users in AAD using Graph API

PowerShell – find and update a string value within all dynamic group membership rules

If your company benefits from using dynamic groups, then you probably know that feature takes its toll - proper maintenance and updates. It usually happens when there are some organizational changes - updated job titles or another department, just to name a few. The purpose of this script is to take that burden away and make updates at once to every single dynamic group that matches the scope of the adjustment. Benefits and nuances of the script: can find and update any string value - doesn't matter if you update a property name or a property value; saves a CSV log file with all values before and after the update; only takes a few seconds to run and adjust up to 20 groups at once; 20 group number comes from a Graph API Batch limitation, more on that here - https://learn.microsoft.com/en-us/graph/json-batching retains membership rule formatting if you used one, more…

Continue ReadingPowerShell – find and update a string value within all dynamic group membership rules

AAD Dynamic Group – example and formatting tips

If your company has at least an Azure AD premium P1 license, then you have access to a powerful feature - Dynamic group membership. Microsoft has a lot of information on how to construct those rules -  https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/groups-dynamic-membership So in my post I would rather focus on some formatting tips: When designing a rule, using a Windows PowerShell ISE or any coding software is helpful for proper spacing Use CRLF (carriage return line feed) to separate blocks in your dynamic rule - AAD system interprets those as spaces without any issues  If you keep formatting nice and tidy (rather than a blob of text), Graph API will preserve that formatting when pulling data for reports Use a combination of -in, -NotIn, and arrays as much as possible - this approach is great to further scale your rule Put OR condition to the very end of the rule A rule below…

Continue ReadingAAD Dynamic Group – example and formatting tips

PowerShell – Script to migrate a security group and all its members from AD to AAD

When you decide it's time to migrate your security groups from on-premise AD to the Cloud, you might find it very tedious and prone to mistakes. Of course that is if you have lots of groups to move. The script in this post should come to your aid as it finds the group you would like to migrate, creates a new group in AAD with a name you choose, then it adds all users and nested groups into the newly created group - the same as your AD group had. A few nice things this script also does: checks if the group you are about to migrate exists in AD; makes sure a group you will be creating in AAD doesn't already exist; combines description and notes, then adds them to a newly created group in AAD. Note that for this script to work well all nested groups must be…

Continue ReadingPowerShell – Script to migrate a security group and all its members from AD to AAD