Skip to content

Commit b782a5e

Browse files
authored
Added azure rest command for webhook creation.
Clarified commands for creating webhooks in Azure Automation by adding the Azure CLI REST method.
1 parent 6ced657 commit b782a5e

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,29 @@ 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+
"runbook": {
174+
"name": "<runbook-name>"
175+
}
176+
}
177+
}'
178+
```
179+
These commands should return a webhook URI which is only displayed on creation. Then, to call the runbook using the webhook URI
164180

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

0 commit comments

Comments
 (0)