You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pentesting-cloud/azure-security/README.md
+24-5Lines changed: 24 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,18 +173,36 @@ You should start finding out the **permissions you have** over the resources. Fo
173
173
174
174
1.**Find the resource you have some acecss to**:
175
175
176
+
> [!TIP]
177
+
> This doesn't require any special permission.
178
+
176
179
The Az PoswerShell command **`Get-AzResource`** lets you **know the resources your current user has visibility over**.
177
180
178
181
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:
179
182
```bash
180
183
az rest --method GET --url "https://management.azure.com/subscriptions/<subscription-id>/resources?api-version=2021-04-01"
181
184
```
182
185
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>
184
201
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.
186
204
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:
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"
201
219
```
202
220
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`**:
204
222
205
223
```bash
206
224
az role assignment list --assignee "<email>" --all --output table
@@ -213,7 +231,7 @@ az rest --method GET --uri 'https://management.azure.com/subscriptions/<subscrip
213
231
```
214
232
215
233
216
-
3. **Find the granular permissions of the roles attached to you**:
234
+
- **Find the granular permissions of the roles attached to you**:
217
235
218
236
Then, to get the granular permission you could run **`(Get-AzRoleDefinition -Id "<RoleDefinitionId>").Actions`**.
219
237
@@ -223,6 +241,7 @@ Or call the API directly with
223
241
az rest --method GET --uri "https://management.azure.com//subscriptions/<subscription-id>/providers/Microsoft.Authorization/roleDefinitions/<RoleDefinitionId>?api-version=2022-04-01" | jq ".properties"
224
242
```
225
243
244
+
</details>
226
245
227
246
In the following section you can find **information about the most common Azure services and how to enumerate them**:
0 commit comments