0

I'm trying to deploy sentinel alerts into sentinel using Azure Runbook by using the below command:

Import-AzSentinelAlertRule -WorkspaceName "xxx" -SettingsFile "test_alert.json" 

The SettingsFile of this command expects a path of json as parameter. How we can pass the json file to runbook?

1 Answer 1

1

How we can pass the json file to runbook?

I have reproduced in my environment and I followed Microsoft-Document and I got expected results as below:

Param(
[parameter(Mandatory=$true)]
[object]$json
)
$json = $json | ConvertFrom-Json

enter image description here

Then save and publish runbook.

Then open your local windows PowerShell and follow below steps:

Step1:

Connect-AzAccount

enter image description here

Step2:

 $json =  (Get-content -path "C:Downloads\xy.json") | Out-string
 

enter image description here

Step3:

$RBParams = @{
     AutomationAccountName = 'rithwikrunning'
     ResourceGroupName = 'XX'
     Name = 'xy'
     Parameters = $JsonParams
}

XX- Name of the resource Group xy- Name of the runbook

enter image description here

Step4:

$job = Start-AzAutomationRunbook @RBParams

enter image description here

Now the json file is passed to run book and it got started:

enter image description here

Now the content of the file or file is in $json variable in runbook.

References:

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Rithwik .. Can you please look this link ?stackoverflow.com/questions/74715980/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.