<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Microsoft Azure Active Directory Reporting Add-on: HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399844#M48784</link>
    <description>&lt;P&gt;Hi @nathanpyen  ,&lt;/P&gt;

&lt;P&gt;Did you have a chance to check out any answers? If any work, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help you. &lt;/P&gt;

&lt;P&gt;Thanks for posting!&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2019 18:07:28 GMT</pubDate>
    <dc:creator>evania</dc:creator>
    <dc:date>2019-06-06T18:07:28Z</dc:date>
    <item>
      <title>Microsoft Azure Active Directory Reporting Add-on: HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399840#M48780</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;We installed MS Azure AD Reporting Add-on version 1.1.0, and getting the following error messages in  ta_ms_aad_MS_AAD_audit.log: &lt;BR /&gt;
(signins.log has its own errors too, but would like to tackle this first) &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-05-30 12:01:03,779 INFO pid=17581 tid=MainThread file=connectionpool.py:_new_conn:758 | Starting new HTTPS connection (1): 127.0.0.1
2019-05-30 12:01:06,523 INFO pid=17581 tid=MainThread file=connectionpool.py:_new_conn:758 | Starting new HTTPS connection (1): 127.0.0.1
2019-05-30 12:01:08,871 INFO pid=17581 tid=MainThread file=setup_util.py:log_info:114 | Log level is not set, use default INFO
2019-05-30 12:01:08,871 INFO pid=17581 tid=MainThread file=splunk_rest_client.py:_request_handler:100 | Use HTTP connection pooling
2019-05-30 12:01:08,873 INFO pid=17581 tid=MainThread file=connectionpool.py:_new_conn:758 | Starting new HTTPS connection (1): 127.0.0.1
2019-05-30 12:01:09,181 ERROR pid=17581 tid=MainThread file=base_modinput.py:log_error:307 | Get error when collecting events.
Traceback (most recent call last):
  File "/opt/splunk/etc/apps/TA-MS-AAD/bin/ta_ms_aad/modinput_wrapper/base_modinput.py", line 127, in stream_events
    self.collect_events(ew)
  File "/opt/splunk/etc/apps/TA-MS-AAD/bin/MS_AAD_audit.py", line 76, in collect_events
    input_module.collect_events(self, ew)
  File "/opt/splunk/etc/apps/TA-MS-AAD/bin/input_module_MS_AAD_audit.py", line 57, in collect_events
    audit_events = azutils.get_items(helper, access_token, url)
  File "/opt/splunk/etc/apps/TA-MS-AAD/bin/azure/utils.py", line 20, in get_items
    raise e
HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com/beta/auditLogs/directoryAudits?$orderby=activityDateTime&amp;amp;$filter=activityDateTime+ge+2019-05-30T04:00:00Z
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I read the questions related to "HTTPError: 401 Client Error" message on other post, and it could be related to API permission issue.  However, I believe we have all the API permissions that we would need.  In the Azure, the app has the following API permissions: &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Azure Active Directory (7)&lt;BR /&gt;
- Directory.AccessAsUser.All   Delegated    Access the directory as the signed-in user&lt;BR /&gt;
- Directory.Read.All           Application  Read directory data&lt;BR /&gt;
- Directory.ReadWrite.All      Delegated    Read and write directory data&lt;BR /&gt;
- Member.Read.Hidden           Application  Read all hidden memberships&lt;BR /&gt;
- User.Read                    Delegated    Sign in and read user profile&lt;BR /&gt;
- User.Read.All                Delegated    Read all users' full profiles&lt;BR /&gt;
- User.ReadBasic.All           Delegated    Read all users' basic profiles&lt;BR /&gt;
Azure Service Management (1)&lt;BR /&gt;
- user_impersonation           Delegated    Access Azure Service Management as organization users (preview)&lt;BR /&gt;
Microsoft Graph (5)&lt;BR /&gt;
- AuditLog.Read.All            Delegated    Read audit log data&lt;BR /&gt;
- Directory.Read.All           Delegated    Read directory data&lt;BR /&gt;
- User.Read                    Delegated    Sign in and read user profile&lt;BR /&gt;
- User.Read.All                Delegated    Read all users' full profiles&lt;BR /&gt;
- User.ReadBasic.All           Delegated    Read all users' basic profiles&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Could anyone point us what are we doing wrong and are we missing? &lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:45:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399840#M48780</guid>
      <dc:creator>nathanpyen</dc:creator>
      <dc:date>2020-09-30T00:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Microsoft Azure Active Directory Reporting Add-on: HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399841#M48781</link>
      <description>&lt;P&gt;The application registration needs to be in the Security Reader role for the subscription also.&lt;/P&gt;

&lt;P&gt;Here's a spreadsheet that's a work-in-progress detailing the add-ons and the permissions needed -&amp;gt; &lt;A href="https://docs.google.com/spreadsheets/d/1YJAqNmcXZU-7O9CxVKupOkR6q2S8TXriMeLAUMYmMs4/edit?usp=sharing"&gt;https://docs.google.com/spreadsheets/d/1YJAqNmcXZU-7O9CxVKupOkR6q2S8TXriMeLAUMYmMs4/edit?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 16:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399841#M48781</guid>
      <dc:creator>jconger</dc:creator>
      <dc:date>2019-05-30T16:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Microsoft Azure Active Directory Reporting Add-on: HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399842#M48782</link>
      <description>&lt;P&gt;jconger,  &lt;/P&gt;

&lt;P&gt;The application is called, Splunk-Integration, and it has Security Reader, Monitoring Reader, and Reader roles for the subscription.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 16:49:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399842#M48782</guid>
      <dc:creator>nathanpyen</dc:creator>
      <dc:date>2019-05-30T16:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Microsoft Azure Active Directory Reporting Add-on: HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399843#M48783</link>
      <description>&lt;P&gt;Okay, after granting following 3 API Application permissions, &lt;BR /&gt;
- AuditLog.Read.All&lt;BR /&gt;
- Directory.Read.All&lt;BR /&gt;
- User.Read.All&lt;BR /&gt;
We are no longer seeing the original error message, HTTPError: 401 Client Error.  &lt;/P&gt;

&lt;P&gt;However, add-on is not returning any events.   Do you know what are we missing? &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;2019-05-30 21:09:53,122 INFO pid=6852 tid=MainThread file=connectionpool.py:_new_conn:758 | Starting new HTTPS connection (1): 127.0.0.1&lt;BR /&gt;
2019-05-30 21:09:54,399 INFO pid=6852 tid=MainThread file=connectionpool.py:_new_conn:758 | Starting new HTTPS connection (1): 127.0.0.1&lt;BR /&gt;
2019-05-30 21:09:56,595 INFO pid=6852 tid=MainThread file=splunk_rest_client.py:_request_handler:100 | Use HTTP connection pooling&lt;BR /&gt;
2019-05-30 21:09:56,596 DEBUG pid=6852 tid=MainThread file=binding.py:get:664 | GET request to &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/config/TA_MS_AAD_checkpointer" target="_blank"&gt;https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/config/TA_MS_AAD_checkpointer&lt;/A&gt; (body: {})&lt;BR /&gt;
2019-05-30 21:09:56,597 INFO pid=6852 tid=MainThread file=connectionpool.py:_new_conn:758 | Starting new HTTPS connection (1): 127.0.0.1&lt;BR /&gt;
2019-05-30 21:09:56,602 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_make_request:387 | "GET /servicesNS/nobody/TA-MS-AAD/storage/collections/config/TA_MS_AAD_checkpointer HTTP/1.1" 200 5307&lt;BR /&gt;
2019-05-30 21:09:56,603 DEBUG pid=6852 tid=MainThread file=binding.py:new_f:71 | Operation took 0:00:00.007515&lt;BR /&gt;
2019-05-30 21:09:56,604 DEBUG pid=6852 tid=MainThread file=binding.py:get:664 | GET request to &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/config/" target="_blank"&gt;https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/config/&lt;/A&gt; (body: {'search': 'TA_MS_AAD_checkpointer', 'offset': 0, 'count': -1})&lt;BR /&gt;
2019-05-30 21:09:56,608 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_make_request:387 | "GET /servicesNS/nobody/TA-MS-AAD/storage/collections/config/?search=TA_MS_AAD_checkpointer&amp;amp;offset=0&amp;amp;count=-1 HTTP/1.1" 200 4505&lt;BR /&gt;
2019-05-30 21:09:56,609 DEBUG pid=6852 tid=MainThread file=binding.py:new_f:71 | Operation took 0:00:00.005022&lt;BR /&gt;
2019-05-30 21:09:56,611 DEBUG pid=6852 tid=MainThread file=binding.py:get:664 | GET request to &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/data/TA_MS_AAD_checkpointer/FCC_Azure_AD_Audits_last_date" target="_blank"&gt;https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/data/TA_MS_AAD_checkpointer/FCC_Azure_AD_Audits_last_date&lt;/A&gt; (body: {})&lt;BR /&gt;
2019-05-30 21:09:56,614 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_make_request:387 | "GET /servicesNS/nobody/TA-MS-AAD/storage/collections/data/TA_MS_AAD_checkpointer/FCC_Azure_AD_Audits_last_date HTTP/1.1" 200 102&lt;BR /&gt;
2019-05-30 21:09:56,615 DEBUG pid=6852 tid=MainThread file=binding.py:new_f:71 | Operation took 0:00:00.003437&lt;BR /&gt;
2019-05-30 21:09:56,621 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_new_conn:809 | Starting new HTTPS connection (1): login.microsoftonline.com&lt;BR /&gt;
2019-05-30 21:09:56,839 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_make_request:400 | &lt;A href="https://login.microsoftonline.com:443" target="_blank"&gt;https://login.microsoftonline.com:443&lt;/A&gt; "POST /bb320f37-44f0-4d6d-bd7e-1e5b79f0e15d/oauth2/v2.0/token HTTP/1.1" 200 1582&lt;BR /&gt;
2019-05-30 21:09:56,843 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_new_conn:809 | Starting new HTTPS connection (1): graph.microsoft.com&lt;BR /&gt;
2019-05-30 21:09:56,942 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_make_request:400 | &lt;A href="https://graph.microsoft.com:443" target="_blank"&gt;https://graph.microsoft.com:443&lt;/A&gt; "GET /beta/auditLogs/directoryAudits?$orderby=activityDateTime&amp;amp;$filter=activityDateTime+ge+2019-05-30T04:00:00Z HTTP/1.1" 200 None&lt;BR /&gt;
2019-05-30 21:09:56,944 DEBUG pid=6852 tid=MainThread file=base_modinput.py:log_debug:286 | **Total directory audit events returned: 0&lt;/EM&gt;*&lt;BR /&gt;
2019-05-30 21:09:56,944 DEBUG pid=6852 tid=MainThread file=binding.py:post:736 | POST request to &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/data/TA_MS_AAD_checkpointer/batch_save" target="_blank"&gt;https://127.0.0.1:8089/servicesNS/nobody/TA-MS-AAD/storage/collections/data/TA_MS_AAD_checkpointer/batch_save&lt;/A&gt; (body: {'body': '[{"_key": "FCC_Azure_AD_Audits_last_date", "state": "\"2019-05-30T04:00:00Z\""}]'})&lt;BR /&gt;
2019-05-30 21:09:56,953 DEBUG pid=6852 tid=MainThread file=connectionpool.py:_make_request:387 | "POST /servicesNS/nobody/TA-MS-AAD/storage/collections/data/TA_MS_AAD_checkpointer/batch_save HTTP/1.1" 200 35&lt;BR /&gt;
2019-05-30 21:09:56,953 DEBUG pid=6852 tid=MainThread file=binding.py:new_f:71 | Operation took 0:00:00.008755*&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:44:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399843#M48783</guid>
      <dc:creator>nathanpyen</dc:creator>
      <dc:date>2020-09-30T00:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Microsoft Azure Active Directory Reporting Add-on: HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399844#M48784</link>
      <description>&lt;P&gt;Hi @nathanpyen  ,&lt;/P&gt;

&lt;P&gt;Did you have a chance to check out any answers? If any work, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help you. &lt;/P&gt;

&lt;P&gt;Thanks for posting!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 18:07:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Microsoft-Azure-Active-Directory-Reporting-Add-on-HTTPError-401/m-p/399844#M48784</guid>
      <dc:creator>evania</dc:creator>
      <dc:date>2019-06-06T18:07:28Z</dc:date>
    </item>
  </channel>
</rss>

