You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/postgresql/flexible-server/quickstart-create-server-cli.md
+35-28Lines changed: 35 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,13 @@ If you prefer to install and use the CLI locally, this quickstart requires Azure
29
29
30
30
## Prerequisites
31
31
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.
33
33
34
34
```azurecli-interactive
35
35
az login
36
36
```
37
37
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).
39
39
40
40
```azurecli
41
41
az account set --subscription <subscription id>
@@ -49,21 +49,24 @@ Create an [Azure resource group](../../azure-resource-manager/management/overvie
49
49
az group create --name myresourcegroup --location westus
50
50
```
51
51
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:
53
53
54
54
```azurecli
55
-
az postgres flexible-server create
55
+
az postgres flexible-server create --name mydemoserver --resource-group myresourcegroup
56
56
```
57
57
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)
62
65
63
66
> [!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).
65
68
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](/cli/azure/postgres/flexible-server#az-postgres-flexible-server-create).
67
70
68
71
> [!NOTE]
69
72
> 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
73
76
To connect to your server, you need to provide host information and access credentials.
74
77
75
78
```azurecli-interactive
76
-
az postgres flexible-server show --resource-group myresourcegroup --name mydemoserver
79
+
az postgres flexible-server show --name mydemoserver --resource-group myresourcegroup
77
80
```
78
81
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.
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.
115
121
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.
> 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.
123
130
@@ -129,7 +136,7 @@ If you don't need these resources for another quickstart/tutorial, you can delet
129
136
az group delete --name myresourcegroup
130
137
```
131
138
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.
133
140
134
141
```azurecli-interactive
135
142
az postgres flexible-server delete --resource-group myresourcegroup --name mydemoserver
0 commit comments