Make browser auth app id optional
This commit is contained in:
@@ -10,6 +10,11 @@ function Get-DefaultIntunePolicyObjectTypes
|
||||
)
|
||||
}
|
||||
|
||||
function Get-DefaultBrowserAppId
|
||||
{
|
||||
"14d82eec-204b-4c2f-b7e8-296a70dab67e"
|
||||
}
|
||||
|
||||
function Get-IntuneManagementProjectRoot
|
||||
{
|
||||
Split-Path -Parent $PSScriptRoot
|
||||
@@ -38,6 +43,7 @@ function Test-AuthParameters
|
||||
{
|
||||
param(
|
||||
[string]$AuthMode,
|
||||
[string]$AppId,
|
||||
[string]$Secret,
|
||||
[string]$Certificate
|
||||
)
|
||||
@@ -47,6 +53,12 @@ function Test-AuthParameters
|
||||
return
|
||||
}
|
||||
|
||||
if(-not $AppId)
|
||||
{
|
||||
throw "Specify -AppId for AppOnly auth."
|
||||
return
|
||||
}
|
||||
|
||||
if((-not $Secret) -and (-not $Certificate))
|
||||
{
|
||||
throw "Specify -Secret or -Certificate for AppOnly auth, or use -AuthMode Browser."
|
||||
@@ -59,7 +71,6 @@ function Invoke-IntuneHeadlessBatch
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$TenantId,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$AppId,
|
||||
|
||||
[string]$Secret,
|
||||
@@ -79,7 +90,12 @@ function Invoke-IntuneHeadlessBatch
|
||||
[string]$BatchFile
|
||||
)
|
||||
|
||||
Test-AuthParameters -AuthMode $AuthMode -Secret $Secret -Certificate $Certificate
|
||||
if($AuthMode -eq "Browser" -and -not $AppId)
|
||||
{
|
||||
$AppId = Get-DefaultBrowserAppId
|
||||
}
|
||||
|
||||
Test-AuthParameters -AuthMode $AuthMode -AppId $AppId -Secret $Secret -Certificate $Certificate
|
||||
|
||||
$projectRoot = Get-IntuneManagementProjectRoot
|
||||
$runtimeModule = Join-Path $projectRoot "Runtime/IntuneManagement.Runtime.psd1"
|
||||
@@ -145,7 +161,6 @@ function Export-IntunePolicies
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$TenantId,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$AppId,
|
||||
|
||||
[string]$Secret,
|
||||
@@ -203,7 +218,6 @@ function Import-IntunePolicies
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$TenantId,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$AppId,
|
||||
|
||||
[string]$Secret,
|
||||
@@ -272,7 +286,6 @@ function Invoke-IntunePolicyAction
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$TenantId,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$AppId,
|
||||
|
||||
[string]$Secret,
|
||||
|
||||
Reference in New Issue
Block a user