(SQL) Tip of the Day: XEvents in SQL Azure V12 and V1


Today’s (SQL) Tip…

Extended events for SQL Azure are and have been quietly available in SQL Azure V1. Currently they work by having several preconfigured xevents sessions available for you to capture. You can see the sessions available by using this query:

select * from sys.event_sessions

To capture the events first you need a storage account setup to gather the files. To do that you can use Azure Storage Explorer 5  http://azurestorageexplorer.codeplex.com/

Connect to your storage account and the setup the security on the container:

  1. Click on the container and hit the Blob Security button.
  2. Create a Shared Access Signature
  3. For permissions, select Read/Write/Delete/List
  4. Pick Start and Expiry
  5. Go to the Shared Access Signatures tab
  6. Click Generate Signature and copy to the clipboard

Next we need to add this storage credential to your SQL Azure database. Connect to your db and run this query, make sure to replace the place holders.

exec sp_create_azure_storage_credential N'EverythingBeforeTheQuestionMarkInTheAccessSignature' ,  N' EverythingAfterTheQuestionMarkInTheAccessSignature '

Now run this query to start the azure_xe_query_detail session, charge start to stop to end the session.

alter event session [azure_xe_query_detail] on database state=start;


Comments (0)

Skip to main content