Skip to content

Commit 4c050eb

Browse files
authored
Update PostGreSQL tutorial to be accurate
1 parent 3670f4f commit 4c050eb

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

articles/postgresql/flexible-server/quickstart-create-server-cli.md

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ If you prefer to install and use the CLI locally, this quickstart requires Azure
2929

3030
## Prerequisites
3131

32-
You'll need to log in to your account using the [az login](/cli/azure/reference-index#az-login) command. Note the **id** property, which refers to **Subscription ID** for your Azure account.
32+
You'll need to log in to your account using the [az login](/cli/azure/reference-index#az-login) command. Note the **id** property in the output, which refers to the **Subscription ID** for your Azure account.
3333

3434
```azurecli-interactive
3535
az login
3636
```
3737

38-
Select the specific subscription under your account using [az account set](/cli/azure/account#az-account-set) command. Make a note of the **id** value from the **az login** output to use as the value for **subscription** argument in the command. If you have multiple subscriptions, choose the appropriate subscription in which the resource should be billed. To get all your subscription, use [az account list](/cli/azure/account#az-account-list).
38+
Select the specific subscription under your account using [az account set](/cli/azure/account#az-account-set) command. Use the **id** value from the **az login** output to use as the value for **subscription** argument in the command. If you have multiple subscriptions, choose the appropriate subscription in which the resource should be billed. To get all your subscription, use [az account list](/cli/azure/account#az-account-list).
3939

4040
```azurecli
4141
az account set --subscription <subscription id>
@@ -49,21 +49,24 @@ Create an [Azure resource group](../../azure-resource-manager/management/overvie
4949
az group create --name myresourcegroup --location westus
5050
```
5151

52-
Create a flexible server with the `az postgres flexible-server create` command. A server can contain multiple databases. The following command creates a server using service defaults and values from your Azure CLI's [local context](https://docs.azure.cn/cli/local-context):
52+
Create a flexible server with the `az postgres flexible-server create` command. A server can contain multiple databases. The following command creates a server in the resource group you just created:
5353

5454
```azurecli
55-
az postgres flexible-server create
55+
az postgres flexible-server create --name mydemoserver --resource-group myresourcegroup
5656
```
5757

58-
The server created has the below attributes:
59-
- Auto-generated server name, admin username, admin password, resource group name (if not already specified in local context), and in the same location as your resource group
60-
- Service defaults for remaining server configurations: compute tier (General Purpose), compute size/SKU (D2s_v3 - 2 vCore, 8 GB RAM), backup retention period (7 days), and PostgreSQL version (12)
61-
- The default connectivity method is Private access (VNet Integration) with an auto-generated virtual network and subnet
58+
Since the default connectivity method is *Public access (allowed IP addresses)*, the command will prompt you for your own IP address to initialize the list of allowed addresses.
59+
60+
The server created has the following attributes:
61+
- The same location as your resource group
62+
- Auto-generated admin username and admin password (which you should save in a secure place)
63+
- A default database named "flexibleserverdb"
64+
- Service defaults for remaining server configurations: compute tier (General Purpose), compute size/SKU (`Standard_D2s_v3` - 2 vCore, 8 GB RAM), backup retention period (7 days), and PostgreSQL version (13)
6265

6366
> [!NOTE]
64-
> The connectivity method cannot be changed after creating the server. For example, if you selected *Private access (VNet Integration)* during create then you cannot change to *Public access (allowed IP addresses)* after create. We highly recommend creating a server with Private access to securely access your server using VNet Integration. Learn more about Private access in the [concepts article](./concepts-networking.md).
67+
> The connectivity method cannot be changed after creating the server. For example, if you selected *Private access (VNet Integration)* during creation, then you cannot change it to *Public access (allowed IP addresses)* after creation. We highly recommend creating a server with Private access to securely access your server using VNet Integration. Learn more about Private access in the [concepts article](./concepts-networking.md).
6568
66-
If you'd like to change any defaults, please refer to the Azure CLI reference documentation <!--FIXME --> for the complete list of configurable CLI parameters.
69+
If you'd like to change any defaults, please refer to the Azure CLI reference for [az postgres flexible-server create](https://learn.microsoft.com/en-us/cli/azure/postgres/flexible-server?view=azure-cli-latest#az-postgres-flexible-server-create).
6770

6871
> [!NOTE]
6972
> Connections to Azure Database for PostgreSQL communicate over port 5432. If you try to connect from within a corporate network, outbound traffic over port 5432 might not be allowed. If this is the case, you can't connect to your server unless your IT department opens port 5432.
@@ -73,51 +76,55 @@ If you'd like to change any defaults, please refer to the Azure CLI reference do
7376
To connect to your server, you need to provide host information and access credentials.
7477

7578
```azurecli-interactive
76-
az postgres flexible-server show --resource-group myresourcegroup --name mydemoserver
79+
az postgres flexible-server show --name mydemoserver --resource-group myresourcegroup
7780
```
7881

79-
The result is in JSON format. Make a note of the **fullyQualifiedDomainName** and **administratorLogin**.
82+
The result is in JSON format. Make a note of the **fullyQualifiedDomainName** and **administratorLogin**. You should have saved the password in the previous step.
8083

81-
<!--FIXME-->
8284
```json
8385
{
8486
"administratorLogin": "myadmin",
87+
"availabilityZone": "3",
88+
"backup": {
89+
"backupRetentionDays": 7,
90+
"earliestRestoreDate": "2022-10-20T18:03:50.989428+00:00",
91+
"geoRedundantBackup": "Disabled"
92+
},
8593
"earliestRestoreDate": null,
8694
"fullyQualifiedDomainName": "mydemoserver.postgres.database.azure.com",
8795
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/mydemoserver",
8896
"location": "westus",
8997
"name": "mydemoserver",
98+
"network": {
99+
"delegatedSubnetResourceId": null,
100+
"privateDnsZoneArmResourceId": null,
101+
"publicNetworkAccess": "Enabled"
102+
},
90103
"resourceGroup": "myresourcegroup",
91104
"sku": {
92-
"capacity": 2,
93105
"name": "Standard_D2s_v3",
94-
"size": null,
95106
"tier": "GeneralPurpose"
96107
},
97-
"publicAccess": "Enabled",
98-
"storageProfile": {
99-
"backupRetentionDays": 7,
100-
"geoRedundantBackup": "Disabled",
101-
"storageMb": 131072
108+
"state": "Ready",
109+
"storage": {
110+
"storageSizeGb": 128
102111
},
103112
"tags": null,
104113
"type": "Microsoft.DBforPostgreSQL/flexibleServers",
105-
"userVisibleState": "Ready",
106-
"version": "12"
114+
"version": "13"
107115
}
108116
```
109117

110118
## Connect using PostgreSQL command-line client
111119

112-
As the flexible server was created with *Private access (VNet Integration)*, you will need to connect to your server from a resource within the same VNet as your server. You can create a virtual machine and add it to the virtual network created.
113-
114-
Once your VM is created, you can SSH into the machine and install the **[psql](https://www.postgresql.org/download/)** command-line tool.
120+
First, install the **[psql](https://www.postgresql.org/download/)** command-line tool.
115121

116-
With psql, connect using the below command. Replace values with your actual server name and password.
122+
With psql, connect to the "flexibleserverdb" database using the below command. Replace values with the auto-generated domain name and username.
117123

118124
```bash
119-
psql -h mydemoserver.postgres.database.azure.com -u mydemouser -p
125+
psql -h mydemoserver.postgres.database.azure.com -U myadmin flexibleserverdb
120126
```
127+
121128
>[!Note]
122129
> If you get an error `The parameter PrivateDnsZoneArguments is required, and must be provided by customer`, this means you may be running an older version of Azure CLI. Please [upgrade Azure CLI](/cli/azure/update-azure-cli) and retry the operation.
123130
@@ -129,7 +136,7 @@ If you don't need these resources for another quickstart/tutorial, you can delet
129136
az group delete --name myresourcegroup
130137
```
131138

132-
If you would just like to delete the one newly created server, you can run the `az postgres flexible-server delete` command.
139+
If you would just like to delete only the newly created server, you can run the `az postgres flexible-server delete` command.
133140

134141
```azurecli-interactive
135142
az postgres flexible-server delete --resource-group myresourcegroup --name mydemoserver

0 commit comments

Comments
 (0)