Skip to content

Commit 8acebaf

Browse files
authored
Add files via upload
1 parent b5d6a18 commit 8acebaf

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

Azure Active Directory/Check-AllPowerfulAzurePerms3.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Scan every subscription for Sonrai’s “Powerful Permissions in Azure.”
44
55
.DESCRIPTION
6-
- Connects using device code.
6+
- Connects using the normal interactive Windows sign-in experience (WAM).
77
- Gathers your user’s role assignments per subscription.
88
- Tests each high-risk permission from the six-part Sonrai blog.
99
- Exports findings to CSV and writes colored console messages.
@@ -14,9 +14,17 @@
1414
- PowerShell 7+ (for colored output)
1515
#>
1616

17-
# 1. Authenticate
18-
Write-Host "→ Authenticating to Azure (Device Code)…" -ForegroundColor Cyan
19-
Connect-AzAccount -UseDeviceAuthentication | Out-Null
17+
# 1. Authenticate using normal interactive sign-in (WAM on Windows)
18+
# Device-code authentication is intentionally not used.
19+
Write-Host "→ Authenticating to Azure (interactive sign-in)..." -ForegroundColor Cyan
20+
21+
# Apply WAM only to this PowerShell process. This avoids changing the user's
22+
# persistent Az configuration and supports Conditional Access and MFA.
23+
if (Get-Command Update-AzConfig -ErrorAction SilentlyContinue) {
24+
Update-AzConfig -EnableLoginByWam $true -Scope Process | Out-Null
25+
}
26+
27+
Connect-AzAccount | Out-Null
2028

2129
# 2. Identify current user
2230
$currentUpn = (Get-AzContext).Account.Id

0 commit comments

Comments
 (0)