Skip to content

Commit a05e0bf

Browse files
author
Markus Vilcinskas
committed
quickfix81
1 parent 544af43 commit a05e0bf

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

articles/active-directory/active-directory-reporting-api-audit-samples.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -87,35 +87,6 @@ Once you finish editing the script, run it and verify that the expected data fro
8787

8888
The script returns output from the audit report in JSON format. It also creates an `audit.json` file with the same output. You can experiment by modifying the script to return data from other reports, and comment out the output formats that you do not need.
8989

90-
## Bash script
91-
#!/bin/bash
92-
93-
# Author: Ken Hoff ([email protected])
94-
# Date: 2015.08.20
95-
# NOTE: This script requires jq (https://stedolan.github.io/jq/)
96-
97-
CLIENT_ID="your-application-client-id-here" # Should be a ~35 character string insert your info here
98-
CLIENT_SECRET="your-application-client-secret-here" # Should be a ~44 character string insert your info here
99-
LOGIN_URL="https://login.microsoftonline.com"
100-
TENANT_DOMAIN="your-directory-name-here.onmicrosoft.com" # For example, contoso.onmicrosoft.com
101-
102-
TOKEN_INFO=$(curl -s --data-urlencode "grant_type=client_credentials" --data-urlencode "client_id=$CLIENT_ID" --data-urlencode "client_secret=$CLIENT_SECRET" "$LOGIN_URL/$TENANT_DOMAIN/oauth2/token?api-version=1.0")
103-
104-
TOKEN_TYPE=$(echo $TOKEN_INFO | ./jq-win64.exe -r '.token_type')
105-
ACCESS_TOKEN=$(echo $TOKEN_INFO | ./jq-win64.exe -r '.access_token')
106-
107-
# get yesterday's date
108-
109-
YESTERDAY=$(date --date='1 day ago' +'%Y-%m-%d')
110-
111-
URL="https://graph.windows.net/$TENANT_DOMAIN/activities/audit?api-version=beta&$filter=activityDate%20gt%20$YESTERDAY"
112-
113-
114-
REPORT=$(curl -s --header "Authorization: $TOKEN_TYPE $ACCESS_TOKEN" $URL)
115-
116-
echo $REPORT | ./jq-win64.exe -r '.value' | ./jq-win64.exe -r ".[]"
117-
118-
11990

12091

12192

0 commit comments

Comments
 (0)