Quickstart: Create a database in 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 by using the Azure portal. For more information about ledger, see Azure SQL Database ledger.
You need 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.
Use 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 Azure subscription you want to use.
For Resource group, select Create new, enter myResourceGroup, and select OK.
For Database name, enter demo.
For Server, select Create new. 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. 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. Enter it again in the Confirm password box.
- Location: Select a location from the dropdown list.
- Allow Azure services to access this server: Select this 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. For this reason, all data in the database will show any evidence of tampering. By default, new tables will be created as updatable ledger tables, even if you don't specify
LEDGER = ONin CREATE TABLE. You can also leave this option unselected. You're then required to enable ledger functionality on a per-table basis when you create new tables by using Transact-SQL.
In the Digest Storage section, Enable automatic digest storage is automatically selected. Then, a new Azure Storage account and container where your digests are stored is created.
Select Review + create at the bottom of the page.
On the Review + create page, after you review, select Create.
Clean up resources
Keep the resource group, server, and single database for the next steps. You'll learn how to use the ledger feature of your database with different methods.
When you're finished using these resources, delete the resource group you created. This action also deletes the server and single database within it.
Use the Azure portal
To delete myResourceGroup and all its resources by using the Azure portal:
- In the portal, search for and select Resource groups. 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 by using different tools and languages: