<?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 Warehouse Audit: How to audit SELECT actions? in Data Warehouse</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4639411#M2844</link>
    <description>&lt;P&gt;I'm running this code in a Fabric Notebook to enable warehouse audit for a newly created Fabric warehouse:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;import sempy.fabric as fabric
client = fabric.FabricRestClient()

payload = {
    "state": "Enabled",
    "retentionDays": "0"
}

url = https://api.fabric.microsoft.com/v1/workspaces/&amp;lt;workspaceId&amp;gt;/warehouses/&amp;lt;warehouseId&amp;gt;/settings/sqlAudit


response = client.patch(url, json=payload)
print(response.json())

response = client.get(url)
print(response.json())&lt;/LI-CODE&gt;
&lt;P&gt;I inserted the actual workspace id and warehouse id in the url.&lt;/P&gt;
&lt;P&gt;Everything above runs successfully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, I wish to configure audit action groups. I try to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data = [ "DATABASE_OBJECT_PERMISSION_CHANGE_GROUP" ]
response = client.post(url + "/setAuditActionsAndGroups", json=data)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above also works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, I tried to do the following, to specifically audit SELECT statements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data = [ "SELECT" ]
response = client.post(url + "/setAuditActionsAndGroups", json=data)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I get the following error:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FabricHTTPException: 500 Internal Server Error for url: https://api.fabric.microsoft.com/v1/workspaces/.../warehouses/.../settings/sqlAudit/setAuditActionsAndGroups
Error: {"requestId":"...","errorCode":"InternalServerError","message":"An internal error occurred."}
Headers: {'Cache-Control': 'no-store, must-revalidate, no-cache', 'Pragma': 'no-cache', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-public-api-error-code': 'InternalServerError', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'RequestId': '...', 'Access-Control-Expose-Headers': 'RequestId', 'Date': 'Sat, 05 Apr 2025 14:11:14 GMT'}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My goal is to enable Audit on SELECT actions (just for test purposes, I guess this can accumulate a lot of data, but I just want to enable it for test purposes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-audit-logs#database-level-audit-action-groups-and-actions" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-audit-logs#database-level-audit-action-groups-and-actions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following does work, but this setting also audits many other actions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data = [ 'BATCH_COMPLETED_GROUP' ]
response = client.post(url + "/setAuditActionsAndGroups", json=data)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the blog and docs I followed:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blog.fabric.microsoft.com/nb-no/blog/introducing-sql-audit-logs-for-fabric-datawarehouse?ft=All" target="_blank" rel="noopener"&gt;Introducing SQL Audit Logs for Fabric Data Warehouse | Microsoft Fabric-blogg | Microsoft Fabric&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/configure-sql-audit-logs?tabs=browser" target="_blank" rel="noopener"&gt;Configure SQL Audit Logs in Fabric Data Warehouse (Preview) - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 05 Apr 2025 15:05:33 GMT</pubDate>
    <dc:creator>frithjof_v</dc:creator>
    <dc:date>2025-04-05T15:05:33Z</dc:date>
    <item>
      <title>Warehouse Audit: How to audit SELECT actions?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4639411#M2844</link>
      <description>&lt;P&gt;I'm running this code in a Fabric Notebook to enable warehouse audit for a newly created Fabric warehouse:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;import sempy.fabric as fabric
client = fabric.FabricRestClient()

payload = {
    "state": "Enabled",
    "retentionDays": "0"
}

url = https://api.fabric.microsoft.com/v1/workspaces/&amp;lt;workspaceId&amp;gt;/warehouses/&amp;lt;warehouseId&amp;gt;/settings/sqlAudit


response = client.patch(url, json=payload)
print(response.json())

response = client.get(url)
print(response.json())&lt;/LI-CODE&gt;
&lt;P&gt;I inserted the actual workspace id and warehouse id in the url.&lt;/P&gt;
&lt;P&gt;Everything above runs successfully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, I wish to configure audit action groups. I try to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data = [ "DATABASE_OBJECT_PERMISSION_CHANGE_GROUP" ]
response = client.post(url + "/setAuditActionsAndGroups", json=data)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above also works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, I tried to do the following, to specifically audit SELECT statements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data = [ "SELECT" ]
response = client.post(url + "/setAuditActionsAndGroups", json=data)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I get the following error:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FabricHTTPException: 500 Internal Server Error for url: https://api.fabric.microsoft.com/v1/workspaces/.../warehouses/.../settings/sqlAudit/setAuditActionsAndGroups
Error: {"requestId":"...","errorCode":"InternalServerError","message":"An internal error occurred."}
Headers: {'Cache-Control': 'no-store, must-revalidate, no-cache', 'Pragma': 'no-cache', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-public-api-error-code': 'InternalServerError', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'RequestId': '...', 'Access-Control-Expose-Headers': 'RequestId', 'Date': 'Sat, 05 Apr 2025 14:11:14 GMT'}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My goal is to enable Audit on SELECT actions (just for test purposes, I guess this can accumulate a lot of data, but I just want to enable it for test purposes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-audit-logs#database-level-audit-action-groups-and-actions" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-audit-logs#database-level-audit-action-groups-and-actions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following does work, but this setting also audits many other actions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data = [ 'BATCH_COMPLETED_GROUP' ]
response = client.post(url + "/setAuditActionsAndGroups", json=data)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the blog and docs I followed:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blog.fabric.microsoft.com/nb-no/blog/introducing-sql-audit-logs-for-fabric-datawarehouse?ft=All" target="_blank" rel="noopener"&gt;Introducing SQL Audit Logs for Fabric Data Warehouse | Microsoft Fabric-blogg | Microsoft Fabric&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/configure-sql-audit-logs?tabs=browser" target="_blank" rel="noopener"&gt;Configure SQL Audit Logs in Fabric Data Warehouse (Preview) - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Apr 2025 15:05:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4639411#M2844</guid>
      <dc:creator>frithjof_v</dc:creator>
      <dc:date>2025-04-05T15:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Warehouse Audit: How to audit SELECT actions?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4639590#M2847</link>
      <description>&lt;P&gt;Check this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/MicrosoftDocs/fabric-docs/blob/main/docs/data-warehouse/configure-sql-audit-logs.md" target="_blank"&gt;https://github.com/MicrosoftDocs/fabric-docs/blob/main/docs/data-warehouse/configure-sql-audit-logs.md&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-audit-logs" target="_blank"&gt;https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-audit-logs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data = ["SCHEMA_OBJECT_ACCESS_GROUP"]&lt;BR /&gt;response = client.post(url + "/setAuditActionsAndGroups", json=data)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;P&gt;SELECT * FROM sys.fn_get_audit_file_v2(&lt;BR /&gt;'&lt;A href="https://onelake.blob.fabric.microsoft.com/" target="_blank"&gt;https://onelake.blob.fabric.microsoft.com/&lt;/A&gt;&amp;lt;workspaceId&amp;gt;/&amp;lt;warehouseId&amp;gt;/Audit/sqldbauditlogs/',&lt;BR /&gt;default, default, default, default)&lt;BR /&gt;WHERE statement_type = 'SELECT'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other option you can try is , not documented though:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data = [{&lt;BR /&gt;"auditActionName": "SELECT",&lt;BR /&gt;"objectName": "YourTableName",&lt;BR /&gt;"objectType": "TABLE",&lt;BR /&gt;"objectSchema": "dbo"&amp;nbsp;&lt;BR /&gt;}]&lt;BR /&gt;response = client.post(url + "/setAuditActionsAndGroups", json=data)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Apr 2025 23:13:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4639590#M2847</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-04-05T23:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Warehouse Audit: How to audit SELECT actions?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4648710#M2884</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="437984" data-lia-user-login="frithjof_v" class="lia-mention lia-mention-user"&gt;frithjof_v&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.&lt;BR /&gt;If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;B Manikanteswara Reddy&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 12:26:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4648710#M2884</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-11T12:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Warehouse Audit: How to audit SELECT actions?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4652847#M2892</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/437984" target="_blank"&gt;@frithjof_v&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.&lt;BR /&gt;If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;B Manikanteswara Reddy&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2025 05:06:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4652847#M2892</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-15T05:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Warehouse Audit: How to audit SELECT actions?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4661330#M2907</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/437984" target="_blank" rel="noopener"&gt;@frithjof_v&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.&lt;BR /&gt;If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;B Manikanteswara Reddy&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 13:50:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Warehouse/Warehouse-Audit-How-to-audit-SELECT-actions/m-p/4661330#M2907</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-21T13:50:07Z</dc:date>
    </item>
  </channel>
</rss>

