Skip to content

Commit fd6e2fd

Browse files
committed
impr
1 parent 564d04c commit fd6e2fd

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/pentesting-cloud/azure-security/README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,36 @@ You should start finding out the **permissions you have** over the resources. Fo
173173

174174
1. **Find the resource you have some acecss to**:
175175

176+
> [!TIP]
177+
> This doesn't require any special permission.
178+
176179
The Az PoswerShell command **`Get-AzResource`** lets you **know the resources your current user has visibility over**.
177180

178181
Moreover, you can get the same info in the **web console** going to [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) or searching for "All resources" or executing:
179182
```bash
180183
az rest --method GET --url "https://management.azure.com/subscriptions/<subscription-id>/resources?api-version=2021-04-01"
181184
```
182185

183-
2. **Find the permissions you have over the resources you have access to and find the roles assigned to you**:
186+
2. **Find the permissions you have over the resources you can see**:
187+
188+
> [!TIP]
189+
> This doesn't require any special permission.
190+
191+
Talking to the API **`https://management.azure.com/{resource_id}/providers/Microsoft.Authorization/permissions?api-version=2022-04-01`** you can get the permissions you have over the specified resource in the **`resource_id`**.
192+
193+
Therefore, **checking each of the resources you have access to**, you can get the permissions you have over them.
194+
195+
> [!WARNING]
196+
> You can automate this enumeration using the tool **[Find_My_Az_Management_Permissions](https://github.com/carlospolop/Find_My_Az_Management_Permissions)**.
197+
198+
199+
<details>
200+
<summary>Enumerate permissions with **`Microsoft.Authorization/roleAssignments/read`**</summary>
184201

185-
Note that you need the permission **`Microsoft.Authorization/roleAssignments/read`** to execute this action.
202+
> [!TIP]
203+
> Note that you need the permission **`Microsoft.Authorization/roleAssignments/read`** to execute this action.
186204
187-
Furthermore, with enough permissions, the role **`Get-AzRoleAssignment`** can be used to **enumerate all the roles** in the subscription or the permission over a specific resource indicatig it like in:
205+
- With enough permissions, the role **`Get-AzRoleAssignment`** can be used to **enumerate all the roles** in the subscription or the permission over a specific resource indicatig it like in:
188206
```bash
189207
Get-AzRoleAssignment -Scope /subscriptions/<subscription-id>/resourceGroups/Resource_Group_1/providers/Microsoft.RecoveryServices/vaults/vault-m3ww8ut4
190208
```
@@ -200,7 +218,7 @@ like in:
200218
az rest --method GET --uri "https://management.azure.com//subscriptions/<subscription-id>/resourceGroups/Resource_Group_1/providers/Microsoft.KeyVault/vaults/vault-m3ww8ut4/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01" | jq ".value"
201219
```
202220

203-
Another option is to get the roles attached to you in azure with:
221+
- Another option is to **get the roles attached to you in azure**. This also requires the permission **`Microsoft.Authorization/roleAssignments/read`**:
204222

205223
```bash
206224
az role assignment list --assignee "<email>" --all --output table
@@ -213,7 +231,7 @@ az rest --method GET --uri 'https://management.azure.com/subscriptions/<subscrip
213231
```
214232
215233
216-
3. **Find the granular permissions of the roles attached to you**:
234+
- **Find the granular permissions of the roles attached to you**:
217235
218236
Then, to get the granular permission you could run **`(Get-AzRoleDefinition -Id "<RoleDefinitionId>").Actions`**.
219237
@@ -223,6 +241,7 @@ Or call the API directly with
223241
az rest --method GET --uri "https://management.azure.com//subscriptions/<subscription-id>/providers/Microsoft.Authorization/roleDefinitions/<RoleDefinitionId>?api-version=2022-04-01" | jq ".properties"
224242
```
225243
244+
</details>
226245
227246
In the following section you can find **information about the most common Azure services and how to enumerate them**:
228247

0 commit comments

Comments
 (0)