From 098c654b91057d625b95daf93adeb85f69c73a3e Mon Sep 17 00:00:00 2001 From: WinDino <36110475+WinDino@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:34:10 +0200 Subject: [PATCH] Updated and fixed the paths Based on the official documentation: https://learn.microsoft.com/en-us/graph/api/resources/security-api-overview?view=graph-rest-1.0 --- .../1.0.0/src/app.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/microsoft-security-and-compliance/1.0.0/src/app.py b/microsoft-security-and-compliance/1.0.0/src/app.py index 77b45cb8..f120429e 100644 --- a/microsoft-security-and-compliance/1.0.0/src/app.py +++ b/microsoft-security-and-compliance/1.0.0/src/app.py @@ -89,9 +89,9 @@ def get_alerts(self, tenant_id, client_id, client_secret, top): graph_url = "https://graph.microsoft.com" session = self.authenticate(tenant_id, client_id, client_secret, graph_url) if top: - graph_url = f"https://graph.microsoft.com/v1.0/security/alerts?$top={top}" + graph_url = f"https://graph.microsoft.com/v1.0/security/alerts_v2?$top={top}" else: - graph_url = f"https://graph.microsoft.com/v1.0/security/alerts?$top=10" + graph_url = f"https://graph.microsoft.com/v1.0/security/alerts_v2?$top=10" ret = session.get(graph_url) print(ret.status_code) print(ret.text) @@ -105,9 +105,9 @@ def get_alerts_by_severity(self, tenant_id, client_id, client_secret, top, sever graph_url = "https://graph.microsoft.com" session = self.authenticate(tenant_id, client_id, client_secret, graph_url) if top: - graph_url = f"https://graph.microsoft.com/v1.0/security/alerts?$filter=Severity eq '{severity}'&$top={top}" + graph_url = f"https://graph.microsoft.com/v1.0/security/alerts_v2?$filter=Severity eq '{severity}'&$top={top}" else: - graph_url = f"https://graph.microsoft.com/v1.0/security/alerts?$filter=Severity eq '{severity}'&$top=5" + graph_url = f"https://graph.microsoft.com/v1.0/security/alerts_v2?$filter=Severity eq '{severity}'&$top=5" ret = session.get(graph_url) print(ret.status_code) print(ret.text) @@ -129,9 +129,9 @@ def get_alerts_by_vendors(self, tenant_id, client_id, client_secret, vendor, top graph_url = "https://graph.microsoft.com" session = self.authenticate(tenant_id, client_id, client_secret, graph_url) if top: - graph_url = f"https://graph.microsoft.com/v1.0/security/alerts?$filter=vendorInformation/provider eq '{vendor_code[vendor]}'&$top={top}" + graph_url = f"https://graph.microsoft.com/v1.0/security/alerts_v2?$filter=vendorInformation/provider eq '{vendor_code[vendor]}'&$top={top}" else: - graph_url = f"https://graph.microsoft.com/v1.0/security/alerts?$filter=vendorInformation/provider eq '{vendor_code[vendor]}'&$top=5" + graph_url = f"https://graph.microsoft.com/v1.0/security/alerts_v2?$filter=vendorInformation/provider eq '{vendor_code[vendor]}'&$top=5" ret = session.get(graph_url) print(ret.status_code) print(ret.text) @@ -446,7 +446,7 @@ def get_custodian(self, tenant_id, client_id, client_secret, case_id, custodian_ def create_custodian(self, tenant_id, client_id, client_secret, case_id, email, apply_hold_to_sources): graph_url = "https://graph.microsoft.com" session = self.authenticate(tenant_id, client_id, client_secret, graph_url) - graph_url = f"https://graph.microsoft.com/beta/compliance/ediscovery/cases/{case_id}/custodians/" + graph_url = f"https://graph.microsoft.com/beta/compliance/ediscovery/cases/{case_id}/custodians" headers = { "Content-Type": "application/json", @@ -523,7 +523,7 @@ def release_custodian(self, tenant_id, client_id, client_secret,case_id, custodi def list_legalholds(self, tenant_id, client_id, client_secret,case_id): graph_url = "https://graph.microsoft.com" session = self.authenticate(tenant_id, client_id, client_secret, graph_url) - graph_url = f"https://graph.microsoft.com/beta/compliance/ediscovery/cases/{case_id}/legalholds" + graph_url = f"https://graph.microsoft.com/beta/compliance/ediscovery/cases/{case_id}/legalHolds" ret = session.get(graph_url) print(ret.status_code) @@ -537,7 +537,7 @@ def list_legalholds(self, tenant_id, client_id, client_secret,case_id): def get_legalhold(self, tenant_id, client_id, client_secret, case_id, legalhold_id): graph_url = "https://graph.microsoft.com" session = self.authenticate(tenant_id, client_id, client_secret, graph_url) - graph_url = f"https://graph.microsoft.com/beta/compliance/ediscovery/cases/{case_id}/custodians/{legalhold_id}" + graph_url = f"https://graph.microsoft.com/beta/compliance/ediscovery/cases/{case_id}/legalHolds/{legalhold_id}" ret = session.get(graph_url) print(ret.status_code)