Skip to content

Instantly share code, notes, and snippets.

@Sp5rky
Created October 6, 2023 03:08
Show Gist options
  • Save Sp5rky/fc1a9cc0d3f67f770e12e8d00dee9903 to your computer and use it in GitHub Desktop.
Save Sp5rky/fc1a9cc0d3f67f770e12e8d00dee9903 to your computer and use it in GitHub Desktop.
Resolve MSFT License GUID -> Display Name
Connect-AzAccount
#74658136-14ec-4630-ad9b-26e160ff0fc6 is the AppId to https://main.iam.ad.ext.azure.com/api/AccountSkus?backfillTenants=false
$Token = (Get-AzAccessToken -ResourceUrl "74658136-14ec-4630-ad9b-26e160ff0fc6").Token | ConvertTo-SecureString -AsPlainText -Force
$webData = Invoke-WebRequest -UseBasicParsing -Uri "https://main.iam.ad.ext.azure.com/api/AccountSkus?backfillTenants=false" `
-Headers @{
"Authorization"="Bearer $([PSCredential]::new("token", $($script:Token)).GetNetworkCredential().Password)"
}
#convert JSON to objects
$licenseData = $webData.Content | ConvertFrom-Json
#make definition hashtable
$resolveLicense = @{}
#populate SKU:name definitions
$licenseData | ForEach-Object { $resolveLicense[$_.skuId] = $_.name }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment