Skip to content
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

[Powerautomate] New Alert Channel with Microsoft Power Automate #1505

Merged
merged 9 commits into from
Jul 28, 2024

Conversation

marssilva
Copy link
Contributor

@marssilva marssilva commented Jul 26, 2024

Description

Microsoft will disable communication with Incoming Webhook, given the announcement https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/

This PR creates a new alert channel using Power Automate

@jertel
Copy link
Owner

jertel commented Jul 26, 2024

Thank you @marssilva. The linter detected whitespace issues in the unit test python file:

py312: commands[1] /home/elastalert/tests> flake8 --config ../setup.cfg .
./alerters/powerautomate_test.py:4:1: F401 'pytest' imported but unused
./alerters/powerautomate_test.py:10:1: E302 expected 2 blank lines, found 1
./alerters/powerautomate_test.py:53:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:65:1: W293 blank line contains whitespace
./alerters/powerautomate_test.py:71:1: W293 blank line contains whitespace
./alerters/powerautomate_test.py:155:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:170:1: E302 expected 2 blank lines, found 1
./alerters/powerautomate_test.py:213:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:228:1: E302 expected 2 blank lines, found 1
./alerters/powerautomate_test.py:271:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:273:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:274:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:275:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:276:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:294:1: E302 expected 2 blank lines, found 1
./alerters/powerautomate_test.py:299:50: E203 whitespace before ':'
./alerters/powerautomate_test.py:338:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:340:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:341:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:342:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:343:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:361:1: E302 expected 2 blank lines, found 1
./alerters/powerautomate_test.py:366:50: E203 whitespace before ':'
./alerters/powerautomate_test.py:405:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:407:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:408:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:409:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:410:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:428:1: E302 expected 2 blank lines, found 1
./alerters/powerautomate_test.py:433:50: E203 whitespace before ':'
./alerters/powerautomate_test.py:436:50: E203 whitespace before ':'
./alerters/powerautomate_test.py:473:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:475:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:476:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:477:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:478:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:481:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:499:1: E302 expected 2 blank lines, found 1
./alerters/powerautomate_test.py:544:25: E131 continuation line unaligned for hanging indent
./alerters/powerautomate_test.py:546:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:547:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:548:29: E122 continuation line missing indentation or outdented
./alerters/powerautomate_test.py:549:29: E122 continuation line missing indentation or outdented

@marssilva
Copy link
Contributor Author

tests revised @jertel

image

@jertel jertel merged commit b5eb6bc into jertel:master Jul 28, 2024
1 check passed
@marssilva marssilva deleted the powerautomate branch July 31, 2024 20:30
@nsano-rururu
Copy link
Collaborator

@jertel

I think this was an oversight in the review.
Perhaps teams.py has a similar implementation, which is why this happened.


elastalert/alerters/powerautomate.py

add

self.ms_power_automate_opensearch_discover_color = self.rule.get('ms_power_automate_opensearch_discover_color', 'default')

before

                "url": opensearch_discover_url,
                "style": self.ms_power_automate_kibana_discover_color
            })    

after

                "url": opensearch_discover_url,
                "style": self.ms_power_automate_opensearch_discover_color
            })    

elastalert/schema.yaml

add

ms_power_automate_opensearch_discover_color: {type: string}

@jertel
Copy link
Owner

jertel commented Aug 17, 2024

Thanks for the thorough review @nsano-rururu. PR to correct this is here: #1519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants