mirror of
https://github.com/Micke-K/IntuneManagement.git
synced 2026-11-27 09:22:26 +01:00
Add -Federated switch for GitHub Actions federated credential auth (#440)
Silent and batch runs can now sign in with a GitHub Actions OIDC token instead of a client secret or certificate. With -Federated, the tool requests the token and passes it to MSAL with WithClientAssertion. The access token is reused until it is within five minutes of expiry, so a bulk export signs in once rather than on every Graph request. Secret and certificate sign-in are unchanged. Contributed by @mattskare.
This commit is contained in:
@@ -89,7 +89,9 @@ function Initialize-CloudAPIManagement
|
||||
[string]
|
||||
$GraphEnvironment,
|
||||
[string]
|
||||
$GCCType
|
||||
$GCCType,
|
||||
[switch]
|
||||
$Federated
|
||||
|
||||
)
|
||||
|
||||
@@ -104,6 +106,7 @@ function Initialize-CloudAPIManagement
|
||||
|
||||
$global:hideUI = ($Silent -eq $true)
|
||||
$global:SilentBatchFile = $SilentBatchFile
|
||||
$global:UseFederated = ($Federated -eq $true)
|
||||
|
||||
if($tenantId)
|
||||
{
|
||||
@@ -123,9 +126,13 @@ function Initialize-CloudAPIManagement
|
||||
Write-Warning "Azure App Id is missing. Use -AppId <AppID> on the command line"
|
||||
}
|
||||
|
||||
if($global:ClientSecret -or $global:ClientCert)
|
||||
if($global:ClientSecret -or $global:ClientCert -or $global:UseFederated)
|
||||
{
|
||||
if($global:ClientSecret)
|
||||
if($global:UseFederated)
|
||||
{
|
||||
Write-Host "Using GitHub Actions Federated Credential"
|
||||
}
|
||||
elseif($global:ClientSecret)
|
||||
{
|
||||
Write-Host "Using Azure App Secret"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user