feat(launcher): add 'Refresh tenant names' menu option
- Menu entry 13 re-queries Graph /organization for every saved tenant - Updates cached TenantName values in Settings.json - Refreshes the active tenant display in the menu header
This commit is contained in:
@@ -275,6 +275,7 @@ $commonParams = @{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$menuItems = @(
|
$menuItems = @(
|
||||||
|
"13. Refresh tenant names"
|
||||||
"12. Initialize auth (one-time setup)"
|
"12. Initialize auth (one-time setup)"
|
||||||
"11. Deploy baseline (dry-run / WhatIf)"
|
"11. Deploy baseline (dry-run / WhatIf)"
|
||||||
"10. Deploy baseline"
|
"10. Deploy baseline"
|
||||||
@@ -333,6 +334,7 @@ while($true)
|
|||||||
10 { $script = "Scripts/Deploy-IntuneBaseline.ps1" }
|
10 { $script = "Scripts/Deploy-IntuneBaseline.ps1" }
|
||||||
11 { $script = "Scripts/Deploy-IntuneBaseline.ps1"; $commonParams.WhatIf = $true }
|
11 { $script = "Scripts/Deploy-IntuneBaseline.ps1"; $commonParams.WhatIf = $true }
|
||||||
12 { $script = "Scripts/Initialize-IntuneAuth.ps1" }
|
12 { $script = "Scripts/Initialize-IntuneAuth.ps1" }
|
||||||
|
13 { $script = $null }
|
||||||
default { continue }
|
default { continue }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,6 +352,38 @@ while($true)
|
|||||||
11 { $commonParams.WhatIf = $true }
|
11 { $commonParams.WhatIf = $true }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($choiceNumber -eq 13)
|
||||||
|
{
|
||||||
|
Write-Host "`nRefreshing tenant names..." -ForegroundColor Cyan
|
||||||
|
$tenantsToRefresh = Get-SavedTenants -SettingsPath $settingsPath
|
||||||
|
$refreshed = 0
|
||||||
|
$failed = 0
|
||||||
|
foreach($t in $tenantsToRefresh)
|
||||||
|
{
|
||||||
|
Write-Host " Resolving $($t.TenantId) ..." -ForegroundColor DarkGray -NoNewline
|
||||||
|
$name = Resolve-TenantName -TenantId $t.TenantId -SettingsPath $settingsPath
|
||||||
|
if($name)
|
||||||
|
{
|
||||||
|
Update-TenantNameCache -SettingsPath $settingsPath -TenantId $t.TenantId -TenantName $name
|
||||||
|
Write-Host " -> $name" -ForegroundColor Green
|
||||||
|
$refreshed++
|
||||||
|
if($t.TenantId -eq $TenantId)
|
||||||
|
{
|
||||||
|
$currentTenant = [PSCustomObject]@{ TenantId = $TenantId; TenantName = $name; Display = "$name ($TenantId)" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host " -> FAILED" -ForegroundColor Red
|
||||||
|
$failed++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Host "`nRefresh complete. Success: $refreshed, Failed: $failed" -ForegroundColor Cyan
|
||||||
|
Write-Host "`nPress any key to return to the menu..." -ForegroundColor DarkGray
|
||||||
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
$scriptPath = Join-Path $projectRoot $script
|
$scriptPath = Join-Path $projectRoot $script
|
||||||
if(-not (Test-Path $scriptPath))
|
if(-not (Test-Path $scriptPath))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user