Device - 51013 - App Protection Policies block managed-app access when user re-authentication fails (disabled Entra ID accounts, blocked sign-ins, expired tokens)#1302
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Zero Trust assessment test (51013) under the PowerShell test suite to evaluate whether Intune App Protection Policies enforce a block/wipe action when managed apps cannot re-authenticate the user (e.g., disabled accounts, blocked sign-ins, revoked/expired tokens), and surfaces the configuration in the report output.
Changes:
- Introduces
Test-Assessment-51013to query iOS/Android managed app protection policies and evaluateappActionIfUnableToAuthenticateUser+ assignment state. - Generates a markdown report table summarizing the auth-failure action and whether each policy would pass/fail.
- Adds a matching
Test-Assessment.51013.mddescription/remediation doc that plugs intoAdd-ZtTestResultDetail.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/powershell/tests/Test-Assessment.51013.ps1 | New assessment test logic + Graph collection + result markdown table generation |
| src/powershell/tests/Test-Assessment.51013.md | New assessment documentation and remediation links with %TestResult% placeholder |
alexandair
left a comment
There was a problem hiding this comment.
@aahmed-spec Please, address my feedback.
| $androidRaw = Invoke-ZtGraphRequest -RelativeUri 'deviceManagement/managedDevices' -Filter "operatingSystem eq 'Android'" -Select 'id' -Top 1 -QueryParameters @{ '$count' = 'true' } -DisablePaging -ApiVersion v1.0 -ErrorAction Stop | ||
| $androidDeviceCount = [int]($androidRaw.'@odata.count') | ||
| } | ||
| catch { |
There was a problem hiding this comment.
Error handling does not distinguish 401/403
The spec says Investigate when Q1/Q2/Q3 returns 401 or 403. The implementation marks any Graph error as Investigate.
Let's check with @KalwaniRavi if that's OK.
|
|
||
| try { | ||
| $iosRaw = Invoke-ZtGraphRequest -RelativeUri 'deviceManagement/managedDevices' -Filter "operatingSystem eq 'iOS' or operatingSystem eq 'iPadOS'" -Select 'id' -Top 1 -QueryParameters @{ '$count' = 'true' } -DisablePaging -ApiVersion v1.0 -ErrorAction Stop | ||
| $iosDeviceCount = [int]($iosRaw.'@odata.count') |
There was a problem hiding this comment.
Is the explicit cast to [int] necessary?
| $androidPolicies = @() | ||
|
|
||
| try { | ||
| $iosPolicies = @(Invoke-ZtGraphRequest -RelativeUri 'deviceAppManagement/iosManagedAppProtections' -Select 'id,displayName,appActionIfUnableToAuthenticateUser,isAssigned,deployedAppCount' -ApiVersion beta -ErrorAction Stop) |
There was a problem hiding this comment.
deployedAppCount is fetched, but never used.
| try { | ||
| $iosPolicies = @(Invoke-ZtGraphRequest -RelativeUri 'deviceAppManagement/iosManagedAppProtections' -Select 'id,displayName,appActionIfUnableToAuthenticateUser,isAssigned,deployedAppCount' -ApiVersion beta -ErrorAction Stop) | ||
|
|
||
| Write-ZtProgress -Activity $activity -Status 'Getting Android app protection policies' |
There was a problem hiding this comment.
deployedAppCount is fetched, but never used.
No description provided.