Quantcast
Channel: windows – Skatterbrainz Blog
Viewing all articles
Browse latest Browse all 29

Skattered Thoughts – Episode 1

$
0
0

I haven’t had many concise thoughts lately about things to complain about, so I thought I’d just share some semi-arranged meanderings of a quasi-organized set of “recent” experiences. If it works, great. If not, it’ll join a long list of composted material feeding stray animals somewhere.

Using PowerShell to Improve M365 License Descriptions

UPDATE 3/29/22 – The CSV file was updated on 3/23/22, so the previous URL is no longer valid. This will happen each time the file is updated/replaced by Microsoft. The URL in the code example below has been updated.

This came from a client request where we had already set up a daily report showing their various license counts, so they can start begging, oops, I mean, requesting purchase of more licenses to stay ahead of new hires. Getting purchases approved is super easy these days.

The interesting thing is that, as of today at least, the mapping of SKU data to descriptive names is maintained in a CSV file posted here. If you’re reading this later, and Microsoft moved the file, don’t hate me for the broken link. Anyhow, I ended up shoving it into a function to be a little easier to reuse. More information on M365 licensing service plans can be found here.

function Get-M365LicenseFriendlyName {
  [CmdletBinding()]
  [OutputType()]
  param (
    [parameter(Mandatory=$False)][string]$LicenseSku = ""
  )
  try {
    if ([string]::IsNullOrEmpty($LicenseSku)) { throw "LicenseSku was not provided" }
    [string]$url = "https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv"
    [string]$csvFile = "$env:TEMP\m365licensedata.csv"
    if (Test-Path $csvFile) {
      Remove-Item -Path $csvFile -Force | Out-Null
    }
    (New-Object system.net.webclient).DownloadFile($url, $csvFile) | Out-Null
    if (Test-Path $csvFile) {
      $csvData = Import-Csv -Path $csvFile -Encoding ASCII
      $result = $(($csvdata | Where-Object {$_.'String_ Id' -eq $LicenseSku} | Select-Object -ExpandProperty "Service_Plans_Included_Friendly_Names") -join ';')
      $result = $result -replace '\?', '-' # replace smart-hyphens with regular boring dumb hyphens that require special training and feeding
      Get-Item -Path $csvFile | Remove-Item -Force -ErrorAction SilentlyContinue | Out-Null
    } else {
      throw "Failed to download file to $csvFile"
    }
  }
  catch {
    $result = "error: $($_.Exception.Message -join ';')"
  }
  finally {
    $result
  }
}

Hopefully, the code example above is easy enough to follow. To use it, just pass in the SKU name, for example…

$FriendlyName = Get-M365LicenseFriendlyName -LicenseSku "AAD_PREMIUM"

The “friendly” name will often return as a list of subordinate, glued-together, micro-products, which collectively add up to a frightening bill, if you’re not careful. But I took a few extra minutes to provide an artisan-quality, hand-crafted, dove-tailed, smooth-finish concatenated result. So AAD_PREMIUM returns the following…

"AZURE ACTIVE DIRECTORY PREMIUM P1;CLOUD APP SECURITY DISCOVERY;EXCHANGE FOUNDATION;MICROSOFT AZURE MULTI-FACTOR AUTHENTICATION"

I’d rather they (yes, Microsoft) will merge this into Graph, so that makes it prettier to get. Maybe this script is helpful, maybe not.

Duct-Taping Azure AD Connect

I got a call today to take a look at why a client’s Azure AD Connect service had not been synchronizing to AzureAD for over a week. We got on a Teams call, joked about shitty weather, shitty applications, shitty contracts, shitty drivers in shitty traffic, and then got to work. I like this guy already.

We took a quick tour of the AADC sync settings, then the sync service UI, and then the connectors. Then popped open a cold PowerShell console and ran Get-ADSyncScheduler. It puked all over the screen something about the account being blocked by, guess what? MFA.

Turned out his colleague went into AzureAD, found the sync service account and beat it with a per-user MFA hammer. We removed the duct tape and set it free. 10 minutes later (because nothing in Azure is instantaneous) everything was fine.

The takeaway: Don’t put MFA on your AADC sync accounts.

New Tools

I bought a Ryobi 9-inch bandsaw recently. I’ll be tweeting pictures of whatever I build with it, as long as I don’t cut my fingers off.

Books / EBooks

Non-Physical Tools

Speaking of tools, but in a metaphysical ethereal quasi-abstract sense, there’s been some recent updates worth noting:

Online Events

Upcoming meetings and meet-ups…

Other Stuff

Until next time…


Viewing all articles
Browse latest Browse all 29

Trending Articles