I have provided my code and JSON format below. I'm using Powershell runbook to retrieve the values from this json. But I am facing error. How can I fix it?
My JSON:
{"hunting": [
{
"displayName":"New Changes made to AWS IAM policy",
"description":"test",
"query":"SecurityEvent | where EventID == \"4687\" | where CommandLine contains \"-noni -ep bypass $\"",
"tactics":["Persistence","LateralMovement","Collection"]
},{
"displayName":"New Consent to Application discovery",
"description":"test",
"query":"SecurityEvent | where EventID == \"4688\" | where CommandLine contains \"-noni -ep bypass $\"",
"tactics":["Persistence","LateralMovement"]
}
]}
My code:
Get-AzStorageBlobContent -Destination $outPath -Container $containerName -Blob $huntingQueryFileName -Context $storageContext -Force
$newHuntingRules = Get-Content -Path "$outPath\$huntingQueryFileName" -Raw | ConvertFrom-Json
Facing the below error:
WARNING: Resulting JSON is truncated as serialization has exceeded the set depth of 2
I executed below script in my environment and was able to successfully retrieve the expected content (from json format).
$path = "C:\temp"
$context = New-AzStorageContext -StorageAccountName "jahnavistorage" -StorageAccountKey "<storageaccountkey>=="
Get-AzStorageBlobContent -Container "<containerName>" -Blob "myjson.json" -Destination $path -context $context
Get-ChildItem -path $path
Get-Content -Raw $path\myjson.json | ConvertFrom-Json
Output: