master
Brie Bruns 4 months ago
parent 2bd353a054
commit 8c1985b520
  1. 29
      m365-groups.php
  2. 4
      m365-secalerts.php

@ -0,0 +1,29 @@
<?php
require_once('vendor/autoload.php');
require_once('config.php');
use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
$guzzle = new \GuzzleHttp\Client();
$url = 'https://login.microsoftonline.com/' . $o365TenantId . '/oauth2/v2.0/token';
$token = json_decode($guzzle->post($url, [
'form_params' => [
'client_id' => $clientId,
'client_secret' => $clientSecret,
'scope' => 'https://graph.microsoft.com/.default',
'grant_type' => 'client_credentials',
],
])->getBody()->getContents());
$accessToken = $token->access_token;
$graph = new Graph();
$graph->setAccessToken($accessToken);
$user = $graph->createRequest("GET", "/groups")
->setReturnType(Model\Group::class)
->execute();
print_r($user);
?>

@ -21,8 +21,8 @@ $accessToken = $token->access_token;
$graph = new Graph();
$graph->setAccessToken($accessToken);
$user = $graph->createRequest("GET", "/security/alerts")
->setReturnType(Model\Security::class)
$user = $graph->createRequest("GET", "/groups")
->setReturnType(Model\groups::class)
->execute();
print_r($user);

Loading…
Cancel
Save