Skip to content

Commit 4be1be3

Browse files
committed
changes
1 parent d4f098a commit 4be1be3

File tree

4 files changed

+95
-86
lines changed

4 files changed

+95
-86
lines changed

articles/sql-database/includes/sql-database-create-single-database.md

Lines changed: 93 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To create a resource group, SQL server, and single database in the Azure portal:
1818

1919
1. Sign in to the [portal](https://portal.azure.com).
2020
1. From the Search bar, search for and select **Azure SQL**.
21-
1. Select **Add**.
21+
1. On the **Azure SQL** page, select **Add**.
2222

2323
![Add to Azure SQL](../media/sql-database-single-database-get-started/sqldbportal.png)
2424

@@ -27,7 +27,7 @@ To create a resource group, SQL server, and single database in the Azure portal:
2727

2828
![Create single database](../media/sql-database-single-database-get-started/create-single-database.png)
2929

30-
1. On the **Basics** tab of the **Create SQL database** form, under **Project details**, drop down and select the correct Azure **Subscription** if it isn't already selected.
30+
1. On the **Basics** tab of the **Create SQL database** form, under **Project details**, select the correct Azure **Subscription** if it isn't already selected.
3131
1. Under **Resource group**, select **Create new**, enter *myResourceGroup*, and select **OK**.
3232
1. Under **Database details**, for **Database name** enter *mySampleDatabase*.
3333
1. For **Server**, select **Create new**.
@@ -62,14 +62,96 @@ To create a resource group, SQL server, and single database in the Azure portal:
6262

6363
![Networking tab](../media/sql-database-single-database-get-started/networking.png)
6464

65+
For more information about firewall settings, see [Allow Azure services and resources to access this server](../sql-database-networkaccess-overview.md) and [Add a private endpoint](../../private-link/private-endpoint-overview.md).
66+
6567
1. On the **Additional settings** tab, in the **Data source** section, for **Use existing data**, select **Sample**.
6668
1. Select **Review + create** at the bottom of the page.
6769

6870
![Additional settings tab](../media/sql-database-single-database-get-started/additional-settings.png)
6971

7072
1. After reviewing settings, select **Create**.
7173

72-
For more information about firewall settings, see [Allow Azure services and resources to access this server](../sql-database-networkaccess-overview.md) and [Add a private endpoint](../../private-link/private-endpoint-overview.md).
74+
# [Azure CLI](#tab/azure-cli)
75+
76+
You can create an Azure resource group, SQL server, and single database using the Azure command-line interface (Azure CLI). If you don't want to use the Azure Cloud Shell, [install Azure CLI](/cli/azure/install-azure-cli) on your computer.
77+
78+
To run the following code sample in Azure Cloud Shell, select **Try it** in the code sample title bar. When the Cloud Shell opens, select **Copy** in the code sample title bar, and paste the code sample into the Cloud Shell window. In the code, replace `<Subscription ID>` with your Azure Subscription ID, and for `$startIp` and `$endIP`, replace `0.0.0.0` with the public IP address of the computer you're using.
79+
80+
Follow the onscreen prompts to sign in to Azure and run the code. Make sure to record the generated server name and password so you can log in to your server and databases.
81+
82+
You can also use the Azure Cloud Shell from the Azure portal, by selecting the Cloud Shell icon on the top bar.
83+
84+
![Azure Cloud Shell](../media/sql-database-single-database-get-started/cloudshell.png)
85+
86+
The first time you use Cloud Shell, select **Bash** in the **Welcome** dialog. Subsequent sessions will use Azure CLI in a Bash environment, or you can select **Bash** from the Cloud Shell control bar.
87+
88+
The following Azure CLI code creates an Azure resource group, SQL server, single database, and firewall rule for access to the server:
89+
90+
```azurecli-interactive
91+
#!/bin/bash
92+
93+
# Sign in to Azure and set execution context (if necessary)
94+
az login
95+
az account set --subscription <Subscription ID>
96+
97+
# Set the resource group name and location for your server
98+
resourceGroupName=myResourceGroup-$RANDOM
99+
location=westus2
100+
101+
# Set an admin login and password for your database
102+
adminlogin=azureuser
103+
password=Azure1234567
104+
105+
# Set a logical server name that is unique in the system
106+
servername=server-$RANDOM
107+
108+
# Set the ip address range that can access your database
109+
startip=0.0.0.0
110+
endip=0.0.0.0
111+
112+
# Create a resource group
113+
az group create \
114+
--name $resourceGroupName \
115+
--location $location
116+
117+
# Create a logical server in the resource group
118+
az sql server create \
119+
--name $servername \
120+
--resource-group $resourceGroupName \
121+
--location $location \
122+
--admin-user $adminlogin \
123+
--admin-password $password
124+
125+
# Configure a firewall rule for the server
126+
az sql server firewall-rule create \
127+
--resource-group $resourceGroupName \
128+
--server $servername \
129+
-n AllowYourIp \
130+
--start-ip-address $startip \
131+
--end-ip-address $endip
132+
133+
# Create a gen5 2 vCore database in the server
134+
az sql db create \
135+
--resource-group $resourceGroupName \
136+
--server $servername \
137+
--name mySampleDatabase \
138+
--sample-name AdventureWorksLT \
139+
--edition GeneralPurpose \
140+
--family Gen5 \
141+
--capacity 2 \
142+
```
143+
144+
The preceding code uses these Azure CLI commands:
145+
146+
| Command | Description |
147+
|---|---|
148+
| [az account set](/cli/azure/account?view=azure-cli-latest#az-account-set) | Sets a subscription to be the current active subscription. |
149+
| [az group create](/cli/azure/group#az-group-create) | Creates a resource group in which all resources are stored. |
150+
| [az sql server create](/cli/azure/sql/server#az-sql-server-create) | Creates a SQL Database server that hosts single databases and elastic pools. |
151+
| [az sql server firewall-rule create](/cli/azure/sql/server/firewall-rule) | Creates a server's firewall rules. |
152+
| [az sql db create](/cli/azure/sql/db?view=azure-cli-latest) | Creates a database. |
153+
154+
For more Azure SQL Database Azure CLI samples, see [Azure CLI samples](../sql-database-cli-samples.md).
73155

74156
# [PowerShell](#tab/azure-powershell)
75157

@@ -79,9 +161,13 @@ You can create an Azure resource group, SQL server, and single database using Wi
79161

80162
To run the following code sample in the Azure Cloud Shell, select **Try it** in the code title bar. When the Cloud Shell opens, select **Copy** in the code sample title bar, and paste the code sample into the Cloud Shell window. In the code, replace `<Subscription ID>` with your Azure Subscription ID, and for `$startIp` and `$endIP`, replace `0.0.0.0` with the public IP address of the computer you're using.
81163

82-
Follow the onscreen prompts to sign in to Azure and run the code. Make sure to record the generated server name and password so you can log in to your server and databases.
164+
Follow the onscreen prompts to sign in to Azure and run the code. Make sure to record the generated server name and password, so you can log in to your server and databases.
83165

84-
You can also use Azure Cloud Shell from the Azure portal by selecting the Cloud Shell icon on the top bar. The first time you use Cloud Shell, select **PowerShell** on the **Welcome** dialog. Subsequent sessions will use PowerShell, or you can select it from the Cloud Shell control bar.
166+
You can also use Azure Cloud Shell from the Azure portal, by selecting the Cloud Shell icon on the top bar.
167+
168+
![Azure Cloud Shell](../media/sql-database-single-database-get-started/cloudshell.png)
169+
170+
The first time you use Cloud Shell, select **PowerShell** on the **Welcome** dialog. Subsequent sessions will use PowerShell, or you can select it from the Cloud Shell control bar.
85171

86172
The following PowerShell code creates an Azure resource group, SQL server, single database, and firewall rule for access to the server:
87173

@@ -143,7 +229,7 @@ The following PowerShell code creates an Azure resource group, SQL server, singl
143229
$database
144230
```
145231

146-
The preceding code uses the following PowerShell cmdlets:
232+
The preceding code uses these PowerShell cmdlets:
147233

148234
| Command | Notes |
149235
|---|---|
@@ -152,83 +238,6 @@ The preceding code uses the following PowerShell cmdlets:
152238
| [New-AzSqlServerFirewallRule](/powershell/module/az.sql/new-azsqlserverfirewallrule) | Creates a firewall rule for a logical server. |
153239
| [New-AzSqlDatabase](/powershell/module/az.sql/new-azsqldatabase) | Creates an Azure SQL Database single database. |
154240

155-
For more Azure SQL Database samples using Azure PowerShell, see [Azure PowerShell samples](sql-database-powershell-samples.md).
156-
157-
# [Azure CLI](#tab/azure-cli)
158-
159-
You can create an Azure resource group, SQL server, and single database using the Azure command-line interface (Azure CLI). If you don't want to use the Azure Cloud Shell, [install Azure CLI](/cli/azure/install-azure-cli) on your computer.
160-
161-
To run the following code sample in Azure Cloud Shell, select **Try it** in the code sample title bar. When the Cloud Shell opens, select **Copy** in the code sample title bar, and paste the code sample into the Cloud Shell window. In the code, replace `<Subscription ID>` with your Azure Subscription ID, and for `$startIp` and `$endIP`, replace `0.0.0.0` with the public IP address of the computer you're using.
162-
163-
Follow the onscreen prompts to sign in to Azure and run the code. Make sure to record the generated server name and password so you can log in to your server and databases.
164-
165-
You can also use the Azure Cloud Shell from the Azure portal by selecting the Cloud Shell icon on the top bar. The first time you use Cloud Shell, select **Bash** in the **Welcome** dialog. Subsequent sessions will use Azure CLI in a Bash environment, or you can select **Bash** from the Cloud Shell control bar.
166-
167-
The following Azure CLI code creates an Azure resource group, SQL server, single database, and firewall rule for access to the server:
168-
169-
```azurecli-interactive
170-
#!/bin/bash
171-
172-
# Sign in to Azure and set execution context (if necessary)
173-
az login
174-
az account set --subscription <Subscription ID>
175-
176-
# Set the resource group name and location for your server
177-
resourceGroupName=myResourceGroup-$RANDOM
178-
location=westus2
179-
180-
# Set an admin login and password for your database
181-
adminlogin=azureuser
182-
password=Azure1234567
183-
184-
# Set a logical server name that is unique in the system
185-
servername=server-$RANDOM
186-
187-
# Set the ip address range that can access your database
188-
startip=0.0.0.0
189-
endip=0.0.0.0
190-
191-
# Create a resource group
192-
az group create \
193-
--name $resourceGroupName \
194-
--location $location
195-
196-
# Create a logical server in the resource group
197-
az sql server create \
198-
--name $servername \
199-
--resource-group $resourceGroupName \
200-
--location $location \
201-
--admin-user $adminlogin \
202-
--admin-password $password
203-
204-
# Configure a firewall rule for the server
205-
az sql server firewall-rule create \
206-
--resource-group $resourceGroupName \
207-
--server $servername \
208-
-n AllowYourIp \
209-
--start-ip-address $startip \
210-
--end-ip-address $endip
211-
212-
# Create a gen5 2 vCore database in the server
213-
az sql db create \
214-
--resource-group $resourceGroupName \
215-
--server $servername \
216-
--name mySampleDatabase \
217-
--sample-name AdventureWorksLT \
218-
--edition GeneralPurpose \
219-
--family Gen5 \
220-
--capacity 2 \
221-
```
222-
223-
The preceding code uses these Azure CLI commands:
224-
225-
| Command | Description |
226-
|---|---|
227-
| [az account set](/cli/azure/account?view=azure-cli-latest#az-account-set) | Sets a subscription to be the current active subscription. |
228-
| [az group create](/cli/azure/group#az-group-create) | Creates a resource group in which all resources are stored. |
229-
| [az sql server create](/cli/azure/sql/server#az-sql-server-create) | Creates a SQL Database server that hosts single databases and elastic pools. |
230-
| [az sql server firewall-rule create](/cli/azure/sql/server/firewall-rule) | Creates a server's firewall rules. |
231-
| [az sql db create](/cli/azure/sql/db?view=azure-cli-latest) | Creates a database. |
241+
For more Azure SQL Database PowerShell samples, see [Azure PowerShell samples](../sql-database-powershell-samples.md).
232242

233-
For more Azure SQL Database Azure CLI samples, see [Azure CLI samples](sql-database-cli-samples.md).
234243
---
18.8 KB
Loading
5.75 KB
Loading

articles/sql-database/sql-database-single-database-get-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ This quickstart requires an active Azure subscription. If you don't have one, [c
3333
Now you can use the built-in **Query editor** in the Azure portal to connect to the database and query the data.
3434

3535
1. On the **SQL Database** page for your database, select **Query editor (preview)** in the left menu.
36-
36+
2. Enter your server admin login information, and select **OK**.
37+
3738
![Sign in to Query editor](./media/sql-database-single-database-get-started/query-editor-login.png)
3839

39-
2. Enter your server admin login information, and select **OK**.
4040
3. Enter the following query in the **Query editor** pane.
4141

4242
```sql

0 commit comments

Comments
 (0)