Skip to content

Instantly share code, notes, and snippets.

@Kaloszer
Created September 26, 2024 09:13
Show Gist options
  • Select an option

  • Save Kaloszer/509c9d1c76fed599bbf625251f590b1a to your computer and use it in GitHub Desktop.

Select an option

Save Kaloszer/509c9d1c76fed599bbf625251f590b1a to your computer and use it in GitHub Desktop.
$uri = "https://management.azure.com/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.OperationalInsights/workspaces/$($WorkspaceName)/providers/Microsoft.SecurityInsights/automationRules?api-version=$($apiVersion)"
Write-Verbose -Verbose $uri
$automationRules = Invoke-RestMethod $uri -Method 'GET' -Headers $headers
while ($null -ne $automationRules.nextLink)
{
$nextLink = $automationRules.nextLink
Write-Verbose -Verbose "Next link found, getting next page"
$nextPageAutomationRules = Invoke-RestMethod $nextLink -Method 'GET' -Headers $headers
$automationRules.value += $nextPageAutomationRules.value
$automationRules.nextLink = $nextPageAutomationRules.nextLink
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment