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

Power Automate – format names to proper case using Select action

  • Post category:Flow
  • Post comments:0 Comments

It is a bit baffling, but as of 2023 and the time of this article, Power Automate still doesn't have toProper() function. There are multiple ways to work around that, to name a few: Select action, Apply to each (loop) action, Azure Automate (PowerShell in the cloud). Personally, I would use Azure Automation (especially when formatting something more than people names) but that would be a more complex approach. The method below works in a pinch. You may ask why one would need to format names to a proper case. Well, when you are dealing with older databases, it's possible the data is formatted with UPPERCASE. Pros: simple and works within Select actions; very fast and doesn't require looping or Azure Automation; handles "up to" triple barrel names; works well in a real life scenario. Cons: only handles "up to" triple barrel names (anything more complex will not be properly converted);…

Continue ReadingPower Automate – format names to proper case using Select action

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

Power Automate – add more data to a CSV log file

  • Post category:Flow
  • Post comments:0 Comments

This Power Automate workflow adds data to the same CSV file after each run. The most common use case is saving results of the workflow to a CSV log file. Of course, it would be a bit more complicated than my test scenario but the concept is exactly the same. Pros of the workflow: puts the most recent data at the top of the CSV file; saves data into a single file rather than multiple (although each approach can have its use case); the latter makes it much easier to search through. The initial file can be empty (just the headers) or have some matching data: 1) Initialize variable action –  varArray variable (Array type). Value: [ { "Name": "John", "Date": "10/12/2022" }, { "Name": "Jeff", "Date": "09/16/2022" } ] 2) Create CSV table action. From: variables('varArray') 3) Initialize variable action –  CRLF variable (String type). Value: uriComponentToString('%0D%0A') 4) Get file metadata using path action. Peek code: "parameters": {…

Continue ReadingPower Automate – add more data to a CSV log file

Power Automate – get all data through paging in Graph API

  • Post category:Flow
  • Post comments:0 Comments

To make it simpler, I will quote an article from Microsoft website: Some queries against Microsoft Graph return multiple pages of data either due to server-side paging or due to the use of the $top query parameter to specifically limit the page size in a request. When more than one query request is required to retrieve all the results, Microsoft Graph returns an @odata.nextLink property in the response that contains a URL to the next page of results. More on that here - https://learn.microsoft.com/en-us/graph/paging The Power Automate workflow below shows how to handle paging and extract all of the data (in my case, the display names of all users). Important! This example is for Graph API only, any other API might structure data differently. The latter will require some adjustments in the workflow. 1) HTTP action. Peek code: { "inputs": { "method": "GET", "uri": "https://graph.microsoft.com/v1.0/users", "queries": { "$top": "4", "$select":…

Continue ReadingPower Automate – get all data through paging in Graph API

Power Automate – format data to output a table with row and column headers

  • Post category:Flow
  • Post comments:0 Comments

Power Automate has an amazing Create HTML table built-in action. Whether you format that table or not after is totally up to you; however, the output table always has standard headers. The flow below shows how to automatically format your table into one with row and column headers at the same time. 1) Initialize variable action –  varArray variable (Array type). Value: [ { "Property": "First Name", "Current": "Lisa", "Requested": "Elisabeth" }, { "Property": "Last Name", "Current": "Smith", "Requested": "Brown" } ] 2) Select action. From: variables('varArray') Select: item()?['Property'] 3) Create HTML table action. From: variables('varArray') 4) Compose action. Inputs: <style> table { border: 1px solid #1C6EA4; background-color: #EEEEEE; width: 70%; text-align: left; border-collapse: collapse; } table th { border: 1px solid #AAAAAA; padding: 3px 2px; } table tbody td { font-size: 13px; } table thead { border-bottom: 1px solid #444444; } table th { font-size: 15px; font-weight: bold; color: #FFFFFF; background:…

Continue ReadingPower Automate – format data to output a table with row and column headers

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

SharePoint Column Formatting – use JSON to show column data in a pop-up window

Sometimes a SharePoint column has too much information, which eventually stretches rows and distorts the look. An example below is a Multiple lines of text type column: This simple JSON code is useful to hide noncrucial information, while still allowing easy access to that data by hovering your mouse cursor over it. { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "style": { "display": "=if(@currentField, '','none')", "font-size": "12px" }, "txtContent": "Hover to see more", "customCardProps": { "formatter": { "elmType": "div", "txtContent": "@currentField", "style": { "padding": "5px 5px 5px 5px", "border": "solid", "border-radius": "2px", "border-width": "1px", "box-shadow": "0 0 2px 0" } }, "openOnEvent": "hover", "directionalHint": "bottomCenter", "isBeakVisible": false } }

Continue ReadingSharePoint Column Formatting – use JSON to show column data in a pop-up window

PowerShell – Office 365 – Disable an entire license package for each user

The purpose of this script is to remove an entire license package from every user. It is especially useful when removing trial license packages but of course not limited to them. Every license package consists of several service plan options. You can disable them one by one with the PowerShell – Office 365 – Enable or disable service plan options within each license package while respecting current configuration for each user script. However, when it comes to the last option left, it won't disable the whole license package. That surely makes you scratch your head and this is why this script is much needed. Just like before, I tried to make it as interactive as possible: the script is interactive - just select all actions; no need to predefine any variables; works with all license packages. This script assumes you are already connected to the right services and have all…

Continue ReadingPowerShell – Office 365 – Disable an entire license package for each user

Microsoft Flow – extremely flexible email merge without any hardcoded mapping

  • Post category:Flow
  • Post comments:0 Comments

Imagine an Email Merge process that doesn't require any mapping per se. A process that is as easy as composing an email. Look no further! The pros of this workflow are: uses a single SharePoint list that can be easily reused for another Email Merge need; use the same SharePoint list to send email merges with a few or lot of fields; preserves all custom html formatting of an email; doesn't use paid connectors and premium Power Automate license; no need for data mapping - you just compose an email using special tags; can have as many columns and as many tags as you would like. Please note, as this workflow is quite complicated logically, I would encourage you to make my example fully work on your side first, then apply its concept to your business needs second. PREREQUISITES: 1) Let's create a SharePoint list. Rename its Title column to…

Continue ReadingMicrosoft Flow – extremely flexible email merge without any hardcoded mapping