Quickstart: Create an Azure SQL Database with ledger enabled

APPLIES TO: Azure SQL Database


Azure SQL Database ledger is currently in public preview.

In this quickstart, you create a ledger database in Azure SQL Database and configure automatic digest storage with Azure Blob storage using the Azure portal. For more information about ledger, see Azure SQL Database ledger.


Create a ledger database and configure digest storage

Create a single ledger database in the serverless compute tier and configure uploading ledger digests to an Azure Storage account.

Using the Azure portal

To create a single database in the Azure portal, this quickstart starts at the Azure SQL page.

  1. Browse to the Select SQL Deployment option page.

  2. Under SQL databases, leave Resource type set to Single database, and select Create.

    Add to Azure SQL

  3. On the Basics tab of the Create SQL Database form, under Project details, select the desired Azure Subscription.

  4. For Resource group, select Create new, enter myResourceGroup, and select OK.

  5. For Database name, enter demo.

  6. For Server, select Create new, and fill out the New server form with the following values:

    • Server name: Enter mysqlserver, and add some characters for uniqueness. We can't provide an exact server name to use because server names must be globally unique for all servers in Azure, not just unique within a subscription. So enter something like mysqlserver12345, and the portal lets you know if it's available or not.
    • Server admin login: Enter azureuser.
    • Password: Enter a password that meets requirements, and enter it again in the Confirm password field.
    • Location: Select a location from the dropdown list.
    • Select Allow Azure services to access this server option to enable access to digest storage.

    Select OK.

  7. Leave Want to use SQL elastic pool set to No.

  8. Under Compute + storage, select Configure database.

  9. This quickstart uses a serverless database, so select Serverless, and then select Apply.

    configure serverless database

  10. On the Networking tab, for Connectivity method, select Public endpoint.

  11. For Firewall rules, set Add current client IP address to Yes. Leave Allow Azure services and resources to access this server set to No.

  12. Select Next: Security at the bottom of the page.

    Networking tab of Create Database in Azure portal

  13. On the Security tab, in the Ledger section, select the Configure ledger option.

    Configure ledger in Security tab of Azure portal

  14. On the Configure ledger pane, in the Ledger section, select the Enable for all future tables in this database checkbox. This setting ensures that all future tables in the database will be ledger tables, which means that all data in the database will be tamper evident. By default, new tables will be created as updatable ledger tables, even if you don't specify LEDGER = ON in CREATE TABLE. Alternatively, you can leave this unselected, requiring you to enable ledger functionality on a per-table basis when creating new tables using Transact-SQL.

  15. In the Digest storage section, Enable automatic digest storage will be automatically selected, subsequently creating a new Azure Storage account and container where your digests will be stored.

  16. Click the Apply button.

    Configure ledger pane in Azure portal

  17. Select Review + create at the bottom of the page:

    Review and create ledger database in Security tab of Azure portal

  18. On the Review + create page, after reviewing, select Create.

Clean up resources

Keep the resource group, server, and single database to go on to the next steps, and learn how to use the ledger feature of your database with different methods.

When you're finished using these resources, you can delete the resource group you created, which will also delete the server and single database within it.

Using the Azure portal

To delete myResourceGroup and all its resources using the Azure portal:

  1. In the portal, search for and select Resource groups, and then select myResourceGroup from the list.
  2. On the resource group page, select Delete resource group.
  3. Under Type the resource group name, enter myResourceGroup, and then select Delete.

Next steps

Connect and query your database using different tools and languages: