Skip to content

Commit 41cf5b7

Browse files
authored
Merge pull request #26966 from MicrosoftDocs/main
05/03 PM Publishing
2 parents ab9ba40 + 4ea2435 commit 41cf5b7

9 files changed

Lines changed: 245 additions & 73 deletions

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
"branch": "main",
6767
"branch_mapping": {}
6868
},
69+
{
70+
"path_to_root": "terraform_samples",
71+
"url": "https://github.com/Azure/terraform",
72+
"branch": "master",
73+
"branch_mapping": {}
74+
},
6975
{
7076
"path_to_root": "azure",
7177
"url": "https://github.com/MicrosoftDocs/azure-docs-pr",

azure-sql/database/high-availability-sla.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,18 @@ The zone-redundant version of the high availability architecture for the General
122122

123123
Consider the following when configuring your General Purpose databases with zone-redundancy:
124124

125-
- For General Purpose tier the zone-redundant configuration is Generally Available in the following regions: West Europe, North Europe, West US 2, France Central, East US 2, East US, Southeast Asia & Qatar Central. This is in preview in the following regions: Australia East, Japan East, and UK South.
125+
- For General Purpose tier the zone-redundant configuration is Generally Available in the following regions:
126+
- (Asia Pacific) Australia East
127+
- (Asia Pacific) Southeast Asia
128+
- (Europe) France Central
129+
- (Europe) North Europe
130+
- (Europe) West Europe
131+
- (Europe) UK South
132+
- (Middle East) Qatar Central
133+
- (North America) East US
134+
- (North America) East US 2
135+
- (North America) West US 2
136+
- It is in preview in the following region: Japan East.
126137
- For zone redundant availability, choosing a [maintenance window](maintenance-window.md) other than the default is currently available in [select regions](maintenance-window.md#azure-region-support).
127138
- Zone-redundant configuration is only available in SQL Database when standard-series (Gen5) hardware is selected.
128139
- Zone-redundancy is not available for Basic and Standard service tiers in the DTU purchasing model.
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
title: 'Quickstart: Create an Azure SQL Database server and database using Terraform'
3+
description: In this article, you create an Azure SQL Database server and database using Terraform.
4+
ms.topic: quickstart
5+
ms.service: sql-database
6+
ms.subservice: deployment-configuration
7+
ms.custom: devx-track-terraform, ai-gen-docs
8+
author: TomArcherMsft
9+
ms.author: tarcher
10+
ms.date: 5/03/2023
11+
---
12+
13+
# Quickstart: Create an Azure SQL Database server and database using Terraform
14+
15+
Creating a [single database](single-database-overview.md) is the quickest and simplest option to create a database in Azure SQL Database. This quickstart shows you how to create a single database using Terraform.
16+
17+
[!INCLUDE [Terraform abstract](~/../azure-dev-docs-pr/articles/terraform/includes/abstract.md)]
18+
19+
In this article, you learn how to:
20+
21+
> [!div class="checklist"]
22+
> * Create a random value for the Azure resource group name using [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet).
23+
> * Create an Azure resource group using [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group).
24+
> * Create a random value for the [logical server in Azure](logical-servers.md) using [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet).
25+
> * Create a random password for the [logical server in Azure](logical-servers.md) using [random_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password).
26+
> * Create a [logical server in Azure](logical-servers.md) using [azurerm_mssql_server](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_server).
27+
> * Create a database in Azure SQL Database using [azurerm_mssql_database](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_database).
28+
29+
[!INCLUDE [AI attribution](~/../azure/includes/ai-generated-attribution.md)]
30+
31+
## Prerequisites
32+
33+
- [Install and configure Terraform](/azure/developer/terraform/quickstart-configure)
34+
35+
## Implement the Terraform code
36+
37+
> [!NOTE]
38+
> The sample code for this article is located in the [Azure Terraform GitHub repo](https://github.com/Azure/terraform/tree/master/quickstart/101-sql-database). You can view the log file containing the [test results from current and previous versions of Terraform](https://github.com/Azure/terraform/tree/master/quickstart//101-sql-database/TestRecord.md).
39+
>
40+
> See more [articles and sample code showing how to use Terraform to manage Azure resources](/azure/terraform)
41+
42+
1. Create a directory in which to test and run the sample Terraform code and make it the current directory.
43+
44+
1. Create a file named `providers.tf` and insert the following code:
45+
46+
[!code-terraform[master](~/../terraform_samples/quickstart/101-sql-database//providers.tf)]
47+
48+
1. Create a file named `main.tf` and insert the following code:
49+
50+
[!code-terraform[master](~/../terraform_samples/quickstart/101-sql-database//main.tf)]
51+
52+
1. Create a file named `variables.tf` and insert the following code:
53+
54+
[!code-terraform[master](~/../terraform_samples/quickstart/101-sql-database//variables.tf)]
55+
56+
1. Create a file named `outputs.tf` and insert the following code:
57+
58+
[!code-terraform[master](~/../terraform_samples/quickstart/101-sql-database//outputs.tf)]
59+
60+
## Initialize Terraform
61+
62+
[!INCLUDE [terraform-init.md](~/../azure-dev-docs-pr/articles/terraform/includes/terraform-init.md)]
63+
64+
## Create a Terraform execution plan
65+
66+
[!INCLUDE [terraform-plan.md](~/../azure-dev-docs-pr/articles/terraform/includes/terraform-plan.md)]
67+
68+
## Apply a Terraform execution plan
69+
70+
[!INCLUDE [terraform-apply-plan.md](~/../azure-dev-docs-pr/articles/terraform/includes/terraform-apply-plan.md)]
71+
72+
## Verify the results
73+
74+
#### [Azure CLI](#tab/azure-cli)
75+
76+
1. Get the Azure resource group name.
77+
78+
```console
79+
resource_group_name=$(terraform output -raw resource_group_name)
80+
```
81+
82+
1. Get the new logical server name.
83+
84+
```console
85+
sql_server_name=$(terraform output -raw sql_server_name)
86+
```
87+
88+
1. Run [az sql db list](http://cli/azure/sql/db#az-sql-db-list) to display the names of all the databases in your server.
89+
90+
```azurecli
91+
az sql db list \
92+
--resource-group $resource_group_name \
93+
--server $sql_server_name \
94+
--output table
95+
```
96+
97+
#### [Azure PowerShell](#tab/azure-powershell)
98+
99+
1. Get the Azure resource group name.
100+
101+
```console
102+
$resource_group_name=$(terraform output -raw resource_group_name)
103+
```
104+
105+
1. Get the new logical server name.
106+
107+
```console
108+
$sql_server_name=$(terraform output -raw sql_server_name)
109+
```
110+
111+
1. Run [Get-AzSqlDatabase](/powershell/module/az.sql/get-azsqldatabase) to display the names of all the databases in your server.
112+
113+
```azurepowershell
114+
Get-AzSqlDatabase -ResourceGroupName $resource_group_name `
115+
-ServerName $sql_server_name `
116+
| Format-Table
117+
```
118+
119+
---
120+
121+
## Clean up resources
122+
123+
[!INCLUDE [terraform-plan-destroy.md](~/../azure-dev-docs-pr/articles/terraform/includes/terraform-plan-destroy.md)]
124+
125+
## Troubleshoot Terraform on Azure
126+
127+
[Troubleshoot common problems when using Terraform on Azure](/azure/developer/terraform/troubleshoot)
128+
129+
## Next steps
130+
131+
> [!div class="nextstepaction"]
132+
> [Create a server-level firewall rule](firewall-create-server-level-portal-quickstart.md)

azure-sql/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@
298298
- name: ARM template
299299
displayName: Resource Manager
300300
href: database/single-database-create-arm-template-quickstart.md
301+
- name: Terraform
302+
href: database/single-database-create-terraform-quickstart.md
301303
- name: With ledger and digest storage
302304
displayName: Create Azure SQL Database with ledger
303305
href: database/ledger-create-a-single-database-with-ledger-enabled.md

docs/azure-data-studio/extensions/add-extensions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to add functionality to Azure Data Studio by selecting an
44
author: markingmyname
55
ms.author: maghan
66
ms.reviewer: erinstellato, randolphwest
7-
ms.date: 12/16/2022
7+
ms.date: 05/02/2023
88
ms.service: azure-data-studio
99
ms.topic: conceptual
1010
---
@@ -101,6 +101,10 @@ You can sort extensions with the `@sort` filter, which can take the following va
101101
- `rating` - Sort by extension gallery rating (1-5 stars), in descending order.
102102
- `name` - Sort alphabetically by extension name.
103103

104+
## Troubleshooting and Support for extensions
105+
106+
To obtain troubleshooting help and support for extensions that you add to Azure Data Studio, please refer to the extension `Details` or `Documentation` page inside Azure Data Studio. The extension author(s) will publish instructions on how to get support if the extension encounters a problem. Authors of a given extension may be from the third-party community.
107+
104108
## Common questions
105109

106110
### Where are extensions installed?

docs/relational-databases/system-stored-procedures/sys-sp-copy-data-in-batches-transact-sql.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
11
---
22
title: "sys.sp_copy_data_in_batches (Transact-SQL)"
3-
description: "sys.sp_copy_data_in_batches (Transact-SQL)"
3+
description: "Copies data from the source table to the target table after verifying that their schema is identical in terms of number of columns, column names and their data types."
44
author: VanMSFT
55
ms.author: vanto
6-
ms.date: "05/24/2022"
6+
ms.reviewer: randolphwest
7+
ms.date: 05/03/2023
78
ms.service: sql
89
ms.subservice: system-objects
910
ms.topic: "reference"
1011
dev_langs:
1112
- "TSQL"
1213
monikerRange: "= azuresqldb-current||>= sql-server-ver16||>= sql-server-linux-ver16"
1314
---
14-
1515
# sys.sp_copy_data_in_batches (Transact-SQL)
1616

1717
[!INCLUDE [SQL Server 2022 Azure SQL Database](../../includes/applies-to-version/sqlserver2022-asdb.md)]
1818

19-
Copies data from the source table to the target table after verifying that their schema is identical in terms of number of columns, column names and their data types. `TRANSACTION ID`, `SEQUENCE NUMBER`, and `GENERATED ALWAYS` columns are ignored since they're system generated and this allows copying data from a regular table to a ledger table and vice versa. Indexes between the tables can be different but the target table can only be a Heap or have a clustered index. The data is copied in batches in individual transactions. If the operation fails, the target table will be partially populated.
19+
Copies data from the source table to the target table after verifying that their schema is identical in terms of number of columns, column names and their data types. `TRANSACTION ID`, `SEQUENCE NUMBER`, and `GENERATED ALWAYS` columns are ignored since they're system generated and this allows copying data from a regular table to a ledger table and vice versa. Indexes between the tables can be different but the target table can only be a heap or have a clustered index. The data is copied in batches in individual transactions. If the operation fails, the target table is partially populated.
20+
21+
For more information on database ledger, see [Ledger](/azure/azure-sql/database/ledger-overview).
2022

21-
For more information on database ledger, see [Ledger](/azure/azure-sql/database/ledger-overview)
23+
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
2224

23-
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
25+
## Syntax
2426

25-
## Syntax
26-
2727
```syntaxsql
28-
sp_copy_data_in_batches [@source_table_name = ] N'source_table_name' , [@target_table_name = ] N'target_table_name'
28+
sp_copy_data_in_batches
29+
[ @source_table_name = ] N'source_table_name'
30+
, [ @target_table_name = ] N'target_table_name'
2931
```
3032

3133
## Arguments
3234

33-
[ @source_table_name = ] N'source_table_name'
35+
#### [ @source_table_name = ] N'*source_table_name*'
36+
3437
The name of the table to be used as the source of the data copy.
3538

36-
[ @target_table_name = ] N'target_table_name'
39+
#### [ @target_table_name = ] N'*target_table_name*'
40+
3741
The name of the table to be used as the target of the data copy.
3842

3943
## Return code values
@@ -46,9 +50,9 @@ None.
4650

4751
## Permissions
4852

49-
This operation requires **SELECT** on the source table, **INSERT** in the target table, and **ALTER** on the target table if there are Foreign Key or Check constraints that will be disabled or an Identity column that will be adjusted.
53+
This operation requires **SELECT** on the source table, **INSERT** in the target table, and **ALTER** on the target table if there are foreign key or check constraints that will be disabled, or an identity column that will be adjusted.
5054

51-
## See also
55+
## Next steps
5256

5357
- [Ledger considerations and limitations](../security/ledger/ledger-limits.md)
5458
- [Ledger overview](../security/ledger/ledger-overview.md)
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,62 @@
11
---
22
title: "sys.sp_generate_database_ledger_digest (Transact-SQL)"
3-
description: "sys.sp_generate_database_ledger_digest (Transact-SQL)"
3+
description: "Generates the ledger digest, which is the hash of the last block in sys.database_ledger_blocks."
44
author: VanMSFT
55
ms.author: vanto
6-
ms.date: "05/24/2022"
6+
ms.reviewer: randolphwest
7+
ms.date: 05/03/2023
78
ms.service: sql
89
ms.subservice: system-objects
910
ms.topic: "reference"
1011
dev_langs:
1112
- "TSQL"
1213
monikerRange: "= azuresqldb-current||>= sql-server-ver16||>= sql-server-linux-ver16"
1314
---
14-
1515
# sys.sp_generate_database_ledger_digest (Transact-SQL)
1616

1717
[!INCLUDE [SQL Server 2022 Azure SQL Database](../../includes/applies-to-version/sqlserver2022-asdb.md)]
1818

19-
Generates the ledger digest, which is the hash of the last block in sys.database_ledger_blocks. If the last block is open (transactions have been grouped to the block but no final block hash has been generated), this stored procedure will close the block and generate the hash. Future transactions will then be assigned to the next block.
19+
Generates the ledger digest, which is the hash of the last block in `sys.database_ledger_blocks`. If the last block is open (transactions have been grouped to the block but no final block hash has been generated), this stored procedure closes the block and generates the hash. Future transactions will then be assigned to the next block.
20+
21+
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
2022

21-
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
23+
## Syntax
2224

23-
## Syntax
24-
2525
```syntaxsql
26-
EXEC sys.sp_generate_database_ledger_digest
26+
sys.sp_generate_database_ledger_digest
2727
```
28+
2829
## Arguments
29-
None
30+
31+
None.
3032

3133
## Return code values
3234

3335
0 (success) or 1 (failure).
3436

3537
## Result sets
3638

37-
|Column name|Description|
38-
|-----------------|---------------|
39-
|**latest_digest**|A JSON document containing the following data:<br/><br/>`database_name` - the name of the database. <br/>`block_id` – same as block_id from the last row in sys.database_ledger_blocks.<br/>`hash` – a hexadecimal string representing a SHA-256 hash of the last row in sys.database_ledger_blocks.<br/>`last_transaction_commit_time` - same as commit_time from the last row in sys.database_ledger_blocks in the ISO 8601 format.<br/>`digest_time` – the time when the digest was generated in the ISO 8601 format.
39+
| Column name | Description |
40+
| --- | --- |
41+
|**latest_digest**|A JSON document containing the following data:<br/><br/>`database_name` - the name of the database. <br/>`block_id` – same as block_id from the last row in `sys.database_ledger_blocks`.<br/>`hash` – a hexadecimal string representing the SHA-256 hash of the last row in `sys.database_ledger_blocks`.<br/>`last_transaction_commit_time` - same as commit_time from the last row in `sys.database_ledger_blocks` in the ISO 8601 format.<br/>`digest_time` – the time when the digest was generated in the ISO 8601 format.
4042

41-
**Example JSON**
43+
**Example of the JSON**
4244

4345
```json
4446
{
45-
"database_name": "contoso",
46-
"block_id": 0,
47-
"hash": "0x6D7D609DE43DDBF84A0346463D6F93CA979846CD5609E02E4FFC96338FC64DD5",
48-
"last_transaction_commit_time": "2020-10-06T16:50:55.1066667",
49-
"digest_time": "2020-10-07T01:13:23.3601279"
47+
"database_name": "contoso",
48+
"block_id": 0,
49+
"hash": "0x6D7D609DE43DDBF84A0346463D6F93CA979846CD5609E02E4FFC96338FC64DD5",
50+
"last_transaction_commit_time": "2020-10-06T16:50:55.1066667",
51+
"digest_time": "2020-10-07T01:13:23.3601279"
5052
}
5153
```
5254

5355
## Permissions
5456

5557
Users with the **public** role are allowed to execute this stored procedure.
5658

57-
## See also
59+
## Next steps
5860

5961
- [Digest management](../security/ledger/ledger-digest-management.md)
6062
- [Ledger overview](../security/ledger/ledger-overview.md)

0 commit comments

Comments
 (0)