![](https://sqlkitty.com/wp-content/uploads/2023/11/image-12-1024x645.png)
I’m saddened that the Workspace Summary is being deprecated in Log Analytics Workspace. I am trying to reproduce it in workbooks. While it isn’t an exact match, workbooks provide me with enough information to use and share with others.
- You can get additional resource examples and explanations about Azure Workbooks from Microsoft. Workbooks are available in different Azure resources, including Log Analytics Workspaces.
These queries only work if you have enabled Azure SQL audit and write it to a log analytics workspace. If you want to know how to set up an Azure SQL Database audit, please visit my blog page on auditing.
Workspace Summary
This is an excellent, high-level summary. It doesn’t get me everything I need, but it is a quick overview. It’s going away – eventually.
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-1024x519.png)
This summary can be found here:
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-17-at-10.47.52-AM-1.png)
Workbooks
This is a possible replacement for the workspace summary. It has different functionality, but it can give you some great options for visualizing and querying your audit data.
You can find the Workbooks option in your LAW here:
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-21-at-10.54.50-AM.png)
Some default ones are provided to you, but they don’t actually query audit data you store from Azure SQL databases. Here is a screenshot of some of the default workbooks available to you:
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-11-1024x631.png)
Creating Your Workbook
I will guide you through creating your workbook from an empty template.
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-22-at-12.00.44-PM.png)
This will open a blank workbook, as you might have guessed. First, we will visualize the count of queries run against each database.
Adding a Chart to Your Workbook
Choose + Add, then Add query.
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-13.png)
This will bring up a blank query box. Put this query into it and click Run Query:
AzureDiagnostics
| where Category == 'SQLSecurityAuditEvents'
and TimeGenerated > ago(1d)
| summarize count () by database_name_s
| render barchart
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-14-1024x666.png)
Then click on Advanced Settings and enter a title:
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-22-at-3.23.01-PM.png)
Click Save at the top of the page. When you start working on a workbook, save it immediately. I noticed that it doesn’t always prompt you to save if it’s newly created and you navigate away from the page.
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-22-at-3.06.32-PM.png)
This will bring up a pane allowing you to name your workbook and click Apply. I put my workbook in the same location as my LAW.
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-16.png)
Once you save it, it will show up in your workbook gallery under recently modified:
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-27.png)
Now, you have one chart without text boxes, parameters, or other queries.
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-17-1024x599.png)
If you are done editing, click Done Editing at the top. If you want to add more, click + Add at the bottom. You most likely want more information than this chart provides since you can’t click on it to drill down.
Adding More Details to Your Workbook
I want more details about specific databases and timeframes. We will need to set parameters and use them to return query results. By clicking + Add, you can add these parameters:
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-22-at-3.31.42-PM.png)
So that you know, you will need to fill in the parameter name. I also added a display name. Click the parameter required checkbox, and don’t allow multiple selections. I also make it a dropdown and populate it from a query:
AzureDiagnostics
| where Category == 'SQLSecurityAuditEvents'
| distinct database_name_s
Add the query and click Run Query before saving:
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-21.png)
I also added a Time Generated parameter:
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-22.png)
Click Done Editing on the parameters box:
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-22-at-3.50.47-PM.png)
You must add a query to use these parameters by clicking + Add and Add query. Use this query there:
AzureDiagnostics
| where Category == 'SQLSecurityAuditEvents'
and database_name_s == '{DatabaseName}'
| project
event_time_t,
database_name_s,
action_name_s,
statement_s,
server_principal_name_s,
succeeded_s,
client_ip_s,
application_name_s,
additional_information_s,
data_sensitivity_information_s
| order by event_time_t desc
| limit 10000
To use the time-generated parameter, you must choose that from the dropdown settings on the query window:
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-22-at-3.46.33-PM.png)
Once you have your query and selected Time Generated for your Time Range, you must select values for your parameters. This is because right now, they will be unset and cause an error:
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-28.png)
Once you select the values, you can click Run Query, and results will display if there are values for that period.
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-25.png)
At this point, you can click Done Editing at the top of the page and SAVE!!
Importing/Exporting Your Workbook
I added more bits and pieces, like titles or explanations, to the page with text boxes. I also added another chart at the bottom to show the count of the different audit actions. These are optional. I’ve exported this as a workbook file, so you can copy this into your setup without having to set it all up manually.
If you want to export/import this all in, you can do so with the <> button. You need to be in edit mode to see and use this button.
![](https://sqlkitty.com/wp-content/uploads/2023/11/Screenshot-2023-11-22-at-12.02.29-PM.png)
After clicking the <> button, you will see two options: Gallery Template and ARM Template. You can click the download button to save a copy. If you want to use an existing template you previously downloaded, you can copy and paste that here and click Apply:
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-20-1024x524.png)
If you copy my workbook, you will have the same setup I have at that point:
![](https://sqlkitty.com/wp-content/uploads/2023/11/image-26.png)
I’m still trying to figure out a way to make a chart clickable – without a separate parameter/query section below the chart. I’ll post again if I find a way to do that!
The post Azure Workbooks appeared first on sqlkitty.