Created
October 6, 2023 03:08
-
-
Save Sp5rky/fc1a9cc0d3f67f770e12e8d00dee9903 to your computer and use it in GitHub Desktop.
Resolve MSFT License GUID -> Display Name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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