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.
- An active Azure subscription. If you don't have one, create a free account.
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.
Browse to the Select SQL Deployment option page.
Under SQL databases, leave Resource type set to Single database, and select Create.
On the Basics tab of the Create SQL Database form, under Project details, select the desired Azure Subscription.
For Resource group, select Create new, enter myResourceGroup, and select OK.
For Database name, enter demo.
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.
Leave Want to use SQL elastic pool set to No.
Under Compute + storage, select Configure database.
This quickstart uses a serverless database, so select Serverless, and then select Apply.
On the Networking tab, for Connectivity method, select Public endpoint.
For Firewall rules, set Add current client IP address to Yes. Leave Allow Azure services and resources to access this server set to No.
Select Next: Security at the bottom of the page.
On the Security tab, in the Ledger section, select the Configure ledger option.
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 = ONin 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.
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.
Click the Apply button.
Select Review + create at the bottom of the page:
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:
- In the portal, search for and select Resource groups, and then select myResourceGroup from the list.
- On the resource group page, select Delete resource group.
- Under Type the resource group name, enter myResourceGroup, and then select Delete.
Connect and query your database using different tools and languages: