Skip to content

Commit 8975152

Browse files
20220325 SQL MI applicability
1 parent 6cc7f85 commit 8975152

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

‎azure-sql/database/xevent-code-event-file.md‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: XEvent Event File code
3-
description: Provides PowerShell and Transact-SQL for a two-phase code sample that demonstrates the Event File target in an extended event on Azure SQL Database. Azure Storage is a required part of this scenario.
3+
description: Provides PowerShell and Transact-SQL for a two-phase code sample that demonstrates the Event File target in an extended event on Azure SQL Database and SQL Managed Instance. Azure Storage is a required part of this scenario.
44
services: sql-database
55
ms.service: sql-database
66
ms.subservice: performance
@@ -10,18 +10,18 @@ ms.topic: sample
1010
author: WilliamDAssafMSFT
1111
ms.author: wiassaf
1212
ms.reviewer: kendralittle, mathoma
13-
ms.date: 06/06/2020
13+
ms.date: 03/25/2022
1414
---
15-
# Event File target code for extended events in Azure SQL Database
16-
[!INCLUDE[appliesto-sqldb](../includes/appliesto-sqldb.md)]
15+
# Event File target code for extended events in Azure SQL Database and SQL Managed Instance
16+
[!INCLUDE[appliesto-sqldb](../includes/appliesto-sqldb-sqlmi.md)]
1717

1818
[!INCLUDE [sql-database-xevents-selectors-1-include](../../../includes/sql-database-xevents-selectors-1-include.md)]
1919

2020
You want a complete code sample for a robust way to capture and report information for an extended event.
2121

22-
In Microsoft SQL Server, the [Event File target](/previous-versions/sql/sql-server-2016/ff878115(v=sql.130)) is used to store event outputs into a local hard drive file. But such files are not available to Azure SQL Database. Instead we use the Azure Storage service to support the Event File target.
22+
In Microsoft SQL Server, the [Event File target](/sql/relational-databases/extended-events/targets-for-extended-events-in-sql-server) is used to store event outputs into a local hard drive file. But local storage is not available to Azure SQL Database or SQL Managed Instance. Instead, use Azure Blob Storage to support the Event File target.
2323

24-
This topic presents a two-phase code sample:
24+
This article presents a two-phase code sample:
2525

2626
- PowerShell, to create an Azure Storage container in the cloud.
2727
- Transact-SQL:
@@ -40,15 +40,11 @@ This topic presents a two-phase code sample:
4040

4141
- Optionally you can [create an **AdventureWorksLT** demonstration database](single-database-create-quickstart.md) in minutes.
4242

43-
- SQL Server Management Studio (ssms.exe), ideally its latest monthly update version.
44-
You can download the latest ssms.exe from:
45-
46-
- Topic titled [Download SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms).
47-
- [A direct link to the download.](https://go.microsoft.com/fwlink/?linkid=616025)
43+
- SQL Server Management Studio (ssms.exe), ideally its latest monthly update version: [Download SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms)
4844

4945
- You must have the [Azure PowerShell modules](https://go.microsoft.com/?linkid=9811175) installed.
5046

51-
- The modules provide commands such as - **New-AzStorageAccount**.
47+
- The modules provide commands, such as - `New-AzStorageAccount`.
5248

5349
## Phase 1: PowerShell code for Azure Storage container
5450

@@ -244,7 +240,7 @@ The script starts with commands to clean up after a possible previous run, and i
244240
The PowerShell script printed a few named values when it ended. You must edit the Transact-SQL script to use those values. Find **TODO** in the Transact-SQL script to locate the edit points.
245241

246242
1. Open SQL Server Management Studio (ssms.exe).
247-
2. Connect to your database in Azure SQL Database.
243+
2. Connect to your database in Azure SQL Database or SQL Managed Instance.
248244
3. Click to open a new query pane.
249245
4. Paste the following Transact-SQL script into the query pane.
250246
5. Find every **TODO** in the script and make the appropriate edits.
@@ -259,7 +255,7 @@ The PowerShell script printed a few named values when it ended. You must edit th
259255
---- TODO: First, run the earlier PowerShell portion of this two-part code sample.
260256
---- TODO: Second, find every 'TODO' in this Transact-SQL file, and edit each.
261257

262-
---- Transact-SQL code for Event File target on Azure SQL Database.
258+
---- Transact-SQL code for Event File target on Azure SQL Database or SQL Managed Instance.
263259

264260
SET NOCOUNT ON;
265261
GO
@@ -501,13 +497,13 @@ An explanation of advanced options for the viewing of data from extended events
501497

502498
Suppose you wanted to run the preceding Transact-SQL sample on Microsoft SQL Server.
503499

504-
- For simplicity, you would want to completely replace use of the Azure Storage container with a simple file such as *C:\myeventdata.xel*. The file would be written to the local hard drive of the computer that hosts SQL Server.
500+
- For simplicity, you would want to completely replace use of the Azure Storage container with a simple file such as `C:\myeventdata.xel`. The file would be written to the local hard drive of the computer that hosts SQL Server.
505501
- You would not need any kind of Transact-SQL statements for **CREATE MASTER KEY** and **CREATE CREDENTIAL**.
506-
- In the **CREATE EVENT SESSION** statement, in its **ADD TARGET** clause, you would replace the Http value assigned made to **filename=** with a full path string like *C:\myfile.xel*.
502+
- In the **CREATE EVENT SESSION** statement, in its **ADD TARGET** clause, you would replace the Http value assigned made to **filename=** with a full path string like `C:\myfile.xel`.
507503

508504
- No Azure Storage account need be involved.
509505

510-
## More information
506+
## Next steps
511507

512508
For more info about accounts and containers in the Azure Storage service, see:
513509

0 commit comments

Comments
 (0)