Skip to content

Commit 38ace28

Browse files
authored
Rename watch_X_job3.ps1 to Watch-AzAutomationRunbookJob.ps1
Updated script name and enhanced documentation for Watch-AzAutomationRunbookJob.ps1, including usage examples and functionality details.
1 parent c0c027f commit 38ace28

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ PowerShell-Scripts/
2727
│ └── Check-AllPowerfulAzurePerms3.ps1
2828
│ └── enum_entra_admins.ps1
2929
│ └── find_disabled_accounts.ps1
30-
│ └── watch_X_job3.ps1
30+
│ └── Watch-AzAutomationRunbookJob.ps1
3131
│ └── Audit-AllUsersRolePerms.ps1
3232
│ └── Get-DisabledUsersLicenses.ps1
3333
│ └── RemoveM365LicensesfromDisabledUsers.ps1
@@ -451,19 +451,36 @@ The application and redirect URI must already be configured by the authorized op
451451
```
452452

453453
---
454-
### `watch_X_job3.ps1`
455-
Using Azure Hybrif Workers? Keep an eye on your Runbook without cikickety-clicking the portal.
456-
Will print out the Runbook logs.
454+
#### Watch-AzAutomationRunbookJob.ps1
457455

456+
Monitors an existing Azure Automation runbook job, periodically reports its current state, and displays newly available Output, Verbose, Warning, Error, or Progress stream records until the job reaches a terminal state.
457+
458+
The script can monitor a supplied job ID or automatically select the most recent job for a specified runbook. It reuses the current Azure PowerShell context by default and does not start, stop, suspend, or modify Azure Automation jobs.
459+
460+
Monitor the latest runbook job
458461
```powershell
459-
.\watch_X_job3.ps1 -ResourceGroupName 'XXX-Hybrid-Automation' -AutomationAccountName 'XXX-Cybersecurity-Automation' -RunbookName pwned
462+
.\Watch-AzAutomationRunbookJob.ps1 `
463+
-ResourceGroupName "rg-automation" `
464+
-AutomationAccountName "aa-security-operations" `
465+
-RunbookName "Invoke-SecurityValidation"
460466
```
461-
or
467+
Monitor a specific job and all streams
462468
```powershell
463-
$job = Start-AzAutomationRunbook -ResourceGroupName 'XXX-Hybrid-Automation' -AutomationAccountName 'XXX-Cybersecurity-Automation' -Name 'pwned' -RunOn 'xxxGroup'
469+
.\Watch-AzAutomationRunbookJob.ps1 `
470+
-ResourceGroupName "rg-automation" `
471+
-AutomationAccountName "aa-security-operations" `
472+
-RunbookName "Invoke-SecurityValidation" `
473+
-JobId "00000000-0000-0000-0000-000000000000" `
474+
-Streams Any `
475+
-PollSeconds 10
464476
```
477+
Permit interactive authentication when required
465478
```powershell
466-
.\watch_X_job3.ps1 -ResourceGroupName 'XXX-Hybrid-Automation' -AutomationAccountName 'XXX-Cybersecurity-Automation' -RunbookName pwned -JobId $job.JobId
479+
.\Watch-AzAutomationRunbookJob.ps1 `
480+
-ResourceGroupName "rg-automation" `
481+
-AutomationAccountName "aa-security-operations" `
482+
-RunbookName "Invoke-SecurityValidation" `
483+
-AllowInteractiveLogin
467484
```
468485

469486
---

0 commit comments

Comments
 (0)