close up of businessman hand using glowing abstrac 2025 10 15 06 23 50 utc
Understanding IAM across environments
Summary

In 2025, identity isn’t just a login; it’s the foundation of every security boundary.
From on-prem servers to Kubernetes clusters and cloud consoles, identity is the new perimeter. For system and cloud administrators, mastering Identity and Access Management (IAM) means understanding how authentication, authorization, and accounting (AAA) work together and how to enforce them consistently across platforms.

The three pillars of IAM: AAA
FunctionPurposeCommon examples
AuthenticationProve who the user is.Passwords, certificates, SSH keys, SSO tokens, biometrics.
AuthorizationDecide what the user can do.File permissions, IAM roles, sudo rules, RBAC policies.
Accounting / AuditingTrack what the user did.Logs, change history, API audit trails.

Each of these layers reinforces the others. A strong password policy without proper authorization still leads to privilege escalation; detailed logging without identity correlation leaves blind spots.

IAM across environments

Windows Active Directory

PowerShell examples:

				
					# List domain admins:
Get-ADGroupMember -Identity "Domain Admins" | Select-Object Name, SamAccountName

# Detect recently added privileged users:
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4728; StartTime=(Get-Date).AddDays(-7)} |
  Select-Object TimeCreated, @{n='UserAdded'; e={$_.Properties[0].Value}}

				
			

Bash snippets:

				
					# List users with sudo privileges:
grep -Po '^sudo.+:\K.*$' /etc/group | tr ',' '\n'

# Find accounts inactive for 90 days:
sudo awk -F: '{if($7=="/bin/bash") print $1}' /etc/passwd |
while read u; do
  lastlog -u "$u" | awk '/Never logged in/ || $NF+0>90{print $1,$NF}'
done

				
			

Zsh snippet:

				
					# List admin group members:
dscl . -read /Groups/admin GroupMembership

				
			

AWS IAM

CLI examples:

				
					# List IAM users without <a href="https://negativepid.blog/online-citizenship-in-spain/">MFA</a>:
aws iam list-users --query 'Users[?!contains(MFADevices[].SerialNumber, `arn:`)]'

# Enforce <a href="https://negativepid.blog/designing-least-privilege-in-the-cloud/">least privilege</a> using policy simulator:
aws iam simulate-principal-policy \
  --policy-source-arn arn:aws:iam::<acct>:user/Admin \
  --action-names s3:ListBucket ec2:TerminateInstances

				
			

Azure AD / Entra ID

PowerShell AZ module examples:

				
					# List users without MFA:
Get-MsolUser -All | Where-Object {$_.StrongAuthenticationMethods.Count -eq 0} |
  Select-Object DisplayName, UserPrincipalName

# Enforce Conditional Access via template:
New-AzureADMSConditionalAccessPolicy -DisplayName "Require MFA" `
  -State "enabled" -Conditions @{Users=@{IncludeUsers=@("All")}} `
  -GrantControls @{BuiltInControls=@("mfa")}

				
			

Google Cloud Platform (GCP)

Gcloud snippets:

				
					# List users with Owner role: 
gcloud projects get-iam-policy my-project \
  --flatten="bindings[].members" \
  --filter="bindings.role:roles/owner" \
  --format="table(bindings.members)"

				
			
Identity in a Zero-Trust world

Traditional perimeter defences assumed the internal network was safe. Zero Trust flips that assumption: “Never trust, always verify.”

Core Zero Trust IAM principles:

Automating IAM Audits with R and JSON

Admins often export IAM data in JSON format from cloud APIs. R is powerful for flattening and analyzing these datasets.

Below are a few examples: 

				
					# Summarize inactive AWS IAM users:
library(jsonlite)
library(dplyr)

iam_data <- fromJSON("aws_iam_users.json", flatten = TRUE)

iam_data$Users %>%
  filter(PasswordLastUsed < Sys.Date() - 90) %>%
  select(UserName, CreateDate, PasswordLastUsed) %>%
  arrange(desc(PasswordLastUsed))


# Compare Azure and AWS policy overlap: 
azure <- fromJSON("azure_roles.json", flatten = TRUE)
aws   <- fromJSON("aws_policies.json", flatten = TRUE)

intersect(azure$roleDefinitionName, aws$PolicyName)

				
			

Such quick checks can highlight excessive privileges or cross-cloud policy drift.

Key takeaways
Share this post :

PID Perspectives is migrating to European Servers. Please, let us know if you experience a slow response or technical issues.