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:
- Click on the container and hit the Blob Security button.
- Create a Shared Access Signature
- For permissions, select Read/Write/Delete/List
- Pick Start and Expiry
- Go to the Shared Access Signatures tab
- 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;