Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| azure:azure_security_assessments [2025/01/03 21:18] – mmuze | azure:azure_security_assessments [2025/06/25 18:59] (current) – [List Azure Role Assignments] mmuze | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Azure Security Assessments ====== | ====== Azure Security Assessments ====== | ||
| + | * [[azure: | ||
| + | * [[azure: | ||
| + | * [[azure: | ||
| + | * [[https:// | ||
| + | |||
| + | ====== Methodology ====== | ||
| + | To begin an assessment list all resources that are in all subscriptions that are in scope to get a sense of the environment. | ||
| + | |||
| + | |||
| + | ====== List All Resources ====== | ||
| + | |||
| + | <code powershell> | ||
| + | $subs = Get-AzSubscription | ||
| + | |||
| + | foreach ($sub in $subs) { | ||
| + | Set-AzContext -Subscription $sub.id | ||
| + | $resources += Get-AzResource | ||
| + | } | ||
| + | |||
| + | $resources | convert-to-json | out-file " . \resources.json" | ||
| + | </ | ||
| + | |||
| + | == List All Resource Types == | ||
| + | Output a unique list of resource types | ||
| + | < | ||
| + | jq ' | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | jq '. | unique_by(.ResourceType) | .[] | .ResourceType' | ||
| + | </ | ||
| ====== List Directory Roles ====== | ====== List Directory Roles ====== | ||
| <code powershell> | <code powershell> | ||
| - | PS C: | + | $DirectoryRoles = Get-AzureADDirectoryRole |
| ObjectId | ObjectId | ||
| -------- | -------- | ||
| 02bb6e8b-bb42-4f30-a527-0cfe44d1a902 Reports Reader | 02bb6e8b-bb42-4f30-a527-0cfe44d1a902 Reports Reader | ||
| - | 042bbd3a-7970-4c1f-a3cb-6d3ae5bddb17 Compliance Data Administrator | + | ... |
| - | 0683f604-2183-4be9-a85a-d4f9f204b8fa User Administrator | + | |
| - | 09951ee1-6fb1-4c6f-9c86-97b3d3fe6cdd Global Administrator | + | |
| - | 12aea5d0-83d8-4a4d-9bed-9b99260250b9 Global Reader | + | |
| - | 14323b4c-ca17-48fa-b0d1-058123c78b0e Directory Writers | + | |
| - | 151928d9-97c4-429e-99cd-37a6d256ecd8 Authentication Policy Administrator | + | |
| - | 1670d62a-547d-4061-8177-d25c0768b7bc Hybrid Identity Administrator | + | |
| - | 188d7e24-5e4f-4050-9b2a-d54de5e57377 Skype for Business Administrator | + | |
| - | 197a0622-3e76-454a-9638-a25202e89c82 Teams Communications Support Engineer | + | |
| - | 1ef22921-f708-494e-a51d-53a2ad0cb4f5 Groups Administrator | + | |
| - | 2b8e368b-f9d2-4766-92ef-d6864a455e73 Privileged Role Administrator | + | |
| - | 2f288736-851d-402a-bd77-0b3842a69503 Intune Administrator | + | |
| - | 2f4d93d3-cd57-47bd-9716-aabbee365915 Authentication Administrator | + | |
| </ | </ | ||
| + | |||
| + | ====== Get Privileged Roles ====== | ||
| + | |||
| + | <code powershell> | ||
| + | $PrivilegedRoles = $DirectoryRoles | Where-Object { | ||
| + | | ||
| + | Reader" | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | ====== List Privilege User Accounts ====== | ||
| + | <code powershell> | ||
| + | $PrivilegedUsers = $PrivilegedRoles | ForEach-Object { Get-MgDirectoryRoleMember -DirectoryRoleId $_.ObjectId } | Select-Object Id -Unique | ||
| + | </ | ||
| + | |||
| ====== List Global Admins ====== | ====== List Global Admins ====== | ||
| Line 28: | Line 63: | ||
| </ | </ | ||
| + | |||
| + | ====== List Azure Role Assignments ====== | ||
| + | <code powershell> | ||
| + | Get-AzRoleAssignment | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | az role assignment list --role "User Access Administrator" | ||
| + | </ | ||
| + | ====== Tools ====== | ||
| + | * [[https:// | ||