-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Deploy ASIM parsers without redeploying the Log Analytics workspace #11299
base: master
Are you sure you want to change the base?
fix: Deploy ASIM parsers without redeploying the Log Analytics workspace #11299
Conversation
The deployment will fail with `ResourceNotFound` error code if the Log Analytics workspace does not exist.
@microsoft-github-policy-service agree company="Loihde Trust Oy" |
@frendsick thanks for helping fix this issue. Updating the ARM templates won't fix the issue as ARM templates get re-generated on every parser update. I guess, the logic you are suggesting, we may need to apply in underlying script as well. I'll try reviewing these changes in this week. |
@vakohl Thank you for explaining the architecture. The KqlFuncYaml2Arm.py script uses func_arm_template.json as base for the ARM-template generation. Thus, we probably need to change the schema to the Does my assumptions sound correct? Would you like me to tackle this change also? |
@frendsick that would be great if you got time to make that change. I'll review and test the changes you suggest, |
Are my original ARM template modifications wanted at all, as they should be generated by the kqlFuncYaml2Arm.ps1 script? That PowerShell just will not trigger because none of the files in |
we would need to fix [current ARM template] + [Scripts to handle future changes] |
Do we need to change the ARM templates for the other parsers rather than the ASIM parsers? In my opinion, this PR should only affect the ASIM parsers. Then, after this PR is merged, you can use the modified kqlFuncYaml2Arm.ps1 to regenerate ARM templates wherever needed. |
I think the script is only used for ASIM parsers |
ASIM parser installation ARM templates should only install the saved search if the Log Analytics workspace already exists. Relates: Azure#8623
Using fixed version of `func_arm_template.json` from dd86c48 The following command was used to generate ARM templates for each ASIM parser schema, where `$SCHEMA` was set first as `ASimAuditEvent`, then `ASimAuthentication`, etc.: `python3 ASIM/dev/ASimYaml2ARM/KqlFuncYaml2Arm.py -m asim -d Parsers/$SCHEMA/ARM Parsers/$SCHEMA/Parsers`
@vakohl I made the required changes to The The only difference between my previous JQ script and the new version of I verified that the changes still work by reinstalling the |
The PR is ready for review. |
@vakohl The most important changes are made to the You can verify if the changes work by running the # Run the command from the root folder of the repository
# $schema => Parser collection, like ASimAuthentication or ASimAuditEvent
python3 ASIM/dev/ASimYaml2ARM/KqlFuncYaml2Arm.py -m asim -d Parsers/$schema/ARM Parsers/$schema/Parsers The generated ARM template files should look the same as the changed files in this PR. You should only see newline changes at the end of files, which do not affect functionality. You can verify if the files match otherwise by using the |
I resolved the merge conflicts by copying the current |
Change(s):
Reason for Change(s):
ResourceNotFound
error code if the Log Analytics workspace given as a parameter does not exist.Version Updated:
Testing Completed:
templateLink
keys to point to the fixed files in my forked repository. The installations succeeded without any conflicts, whereas the old parser collection ARM templates always had some conflicts.ASimFullDeployment.json
as it points to the intermediate ASIM parser collections in theAzure/Azure-Sentinel
repository.Checked that the validations are passing and have addressed any issues that are present:
How the changes were made?
I modified each of the ARM templates with the following shell script, which does the JSON editing using
jq
. Both thefix-asim-parsers.sh
andfix-asim-arm.jq
scripts were located in the root directory of theAzure-Sentinel
repository.fix-asim-parsers.sh
fix-asim-arm.jq
:Screenshot of testing installation of the ASimRegistryEvent parser collection: