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:2 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:11 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