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: modules/2-deploy-linux-postgresql-infrastructure.md
+55-28Lines changed: 55 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,14 @@ You're guided through the creation of the compute resources that host your appli
6
6
7
7
There are multiple methods to deploy infrastructure in Azure, including the Azure portal, Azure CLI, and Infrastructure as Code templates including Bicep and Terraform.
8
8
9
-
In this module, we show you how to deploy a preconfigured [Bicep](/azure/azure-resource-manager/bicep/overview?tabs=bicep) template that encapsulates the compute resources required for your application.
9
+
In this module, we show you how to deploy a preconfigured [Bicep][docs-rel-1] template that encapsulates the compute resources required for your application.
10
10
11
11
The key resources deployed are:
12
12
13
13
- Virtual Machine (VM) running Linux (Ubuntu 24.04 LTS).
14
-
- Azure Database for Postgres running [Postgres 16 or above](https://www.postgresql.org/download/).
15
-
- A [Managed Identity](/entra/identity/managed-identities-azure-resources/overview) to enable secure access from the VM to the database.
16
-
-[Role-Based Access Controls (RBAC)](/azure/role-based-access-control/overview) including roles to access the database as an administrator, and more restrictive roles for the application itself.
14
+
- Azure Database for Postgres running [Postgres 16 or above][2].
15
+
- A [Managed Identity][3] to enable secure access from the VM to the database.
16
+
-[Role-Based Access Controls (RBAC)][docs-rel-4] including roles to access the database as an administrator, and more restrictive roles for the application itself.
17
17
- A Virtual Network for both the VM and database.
18
18
19
19
As this is a test/dev workload, and we're looking to keep things both cost-effective and performant, we've chosen the following configuration for you:
@@ -24,11 +24,11 @@ The database SKU is a General Purpose, D2ds_v4, 2 vCores, 8-GB RAM with 3200 max
24
24
25
25
At the completion of the module, you delete these resources to save cost. However, you can also turn off the VM and database when not in use to save compute cost, and pay only for the storage used. This workload can also be scaled up as needed.
26
26
27
-
The Bicep template in this module utilizes [Azure Verified Modules (AVM)](https://azure.github.io/Azure-Verified-Modules/) which is "an initiative to consolidate and set the standards for what a good Infrastructure-as-Code module looks like". Microsoft maintains these modules and they encapsulate many best practices for deploying resources in Azure.
27
+
The Bicep template in this module utilizes [Azure Verified Modules (AVM)][5] which is "an initiative to consolidate and set the standards for what a good Infrastructure-as-Code module looks like". Microsoft maintains these modules and they encapsulate many best practices for deploying resources in Azure.
28
28
29
29
## Azure Subscription and Azure CLI
30
30
31
-
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
31
+
If you don't have an Azure subscription, create a [free account][6] before you begin.
32
32
33
33
This module requires Azure CLI version 2.0.30 or later.
34
34
@@ -38,7 +38,7 @@ Find the version with the following command:
38
38
az --version
39
39
```
40
40
41
-
If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
41
+
If you need to install or upgrade, see [Install Azure CLI][docs-rel-7].
42
42
43
43
## Sign in to Azure using the CLI
44
44
@@ -50,7 +50,7 @@ az login
50
50
51
51
## Create a resource group
52
52
53
-
A resource group is a container for related resources. All resources must be placed in a resource group. The [az group create](/cli/azure/group) command creates a resource group.
53
+
A resource group is a container for related resources. All resources must be placed in a resource group. The [az group create][docs-rel-8] command creates a resource group.
54
54
55
55
```bash
56
56
az group create \
@@ -62,8 +62,8 @@ az group create \
62
62
63
63
Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. In a Bicep file, you define the infrastructure you want to deploy to Azure, and then use that file throughout the development lifecycle to repeatedly deploy your infrastructure. Your resources are deployed in a consistent manner.
64
64
65
-
The bicep file we're using to deploy the compute resources is located at [deploy/vm-postgres.bicep](https://github.com/Azure-Samples/linux-postgres-migration/blob/main/deploy/vm-postgres.bicep). It contains a Virtual Machine, a Virtual Network, a Managed Identity, a Network Security Group for the VM. You can read
66
-
more about Bicep on [What is Bicep?](/azure/azure-resource-manager/bicep/overview?tabs=bicep).
65
+
The bicep file we're using to deploy the compute resources is located at [deploy/vm-postgres.bicep][9]. It contains a Virtual Machine, a Virtual Network, a Managed Identity, a Network Security Group for the VM. You can read
66
+
more about Bicep on [What is Bicep?][docs-rel-1].
67
67
68
68
If you run this command on your local machine, first clone the example repo to your machine.
69
69
@@ -93,7 +93,7 @@ We can encode these roles and rules into our Bicep template we choose to use the
93
93
94
94
## Open the Resource Group in the Azure portal
95
95
96
-
Open the Azure portal at [https://portal.azure.com](https://portal.azure.com).
96
+
Open the Azure portal at [https://portal.azure.com][10].
97
97
98
98
In the left-hand navigation pane, select **Resource groups**.
99
99
@@ -117,13 +117,13 @@ At the top of the page, select the breadcrumb link to return to the Resource Gro
117
117
118
118
Note the `240900-linux-postgres-identity` User Assigned Managed Identity is listed in the Resource Group.
119
119
120
-
You can learn more about System Assigned and User Assigned managed identities in [What are managed identities for Azure resources?](/entra/identity/managed-identities-azure-resources/overview#managed-identity-types).
120
+
You can learn more about System Assigned and User Assigned managed identities in [What are managed identities for Azure resources?][11].
121
121
122
122
## Add an Inbound Security Rule to the Network Security Group
123
123
124
124
Next you add an inbound security rule to allow SSH traffic from your current IP address to the Virtual Machine.
125
125
126
-
In a production scenario, you would often use [just-in-time access](/azure/defender-for-cloud/just-in-time-access-usage), [Azure Bastion](/azure/bastion/bastion-overview), or a VPN (such as Azure or a mesh VPN) to secure your Virtual Machine. These security approaches allow you to restrict access to the Virtual Machine to only when needed.
126
+
In a production scenario, you would often use [just-in-time access][docs-rel-12], [Azure Bastion][docs-rel-13], or a VPN (such as Azure or a mesh VPN) to secure your Virtual Machine. These security approaches allow you to restrict access to the Virtual Machine to only when needed.
127
127
128
128
Now add an inbound security rule to the NSG to allow SSH traffic from your current IP address.
129
129
@@ -155,7 +155,7 @@ In the upcoming section you use the identity from the Virtual Machine to adminis
155
155
156
156
In a production scenario, you would likely use a combination of Managed Identities, Microsoft Entra ID, and fine-grained Role-Based Access Control (RBAC) to enable your application workload to access data and manage resources in Azure securely, following the principle of least privilege.
157
157
158
-
Read more about these scenarios via [Microsoft Entra authentication with Azure Database for PostgreSQL - Flexible Server](/azure/postgresql/flexible-server/concepts-azure-ad-authentication) and [Use Microsoft Entra ID for authentication with Azure Database for PostgreSQL - Flexible Server](/azure/postgresql/flexible-server/how-to-configure-sign-in-azure-ad-authentication).
158
+
Read more about these scenarios via [Microsoft Entra authentication with Azure Database for PostgreSQL - Flexible Server][docs-rel-14] and [Use Microsoft Entra ID for authentication with Azure Database for PostgreSQL - Flexible Server][docs-rel-15].
159
159
160
160
## Review the Azure Database for PostgreSQL Flexible Server Firewall Rules
161
161
@@ -173,7 +173,7 @@ In production, we would likely further isolate this server from the public inter
173
173
174
174
Unlike the Virtual Machine, we haven't associated our Azure Database for PostgreSQL with any Virtual Network. This means we retain the option of accessing it over the public internet which is useful for test/dev scenarios.
175
175
176
-
To provide both security and flexibility, we enable access from the Virtual Machine via its Virtual Network using a private endpoint. The private endpoint allows the Virtual Machine to access the database without exposing it to the public internet. Read more about private endpoints in [Azure Database for PostgreSQL - Flexible Server networking with Private Link](/azure/postgresql/flexible-server/concepts-private-link).
176
+
To provide both security and flexibility, we enable access from the Virtual Machine via its Virtual Network using a private endpoint. The private endpoint allows the Virtual Machine to access the database without exposing it to the public internet. Read more about private endpoints in [Azure Database for PostgreSQL - Flexible Server networking with Private Link][docs-rel-16].
177
177
178
178
We use the Azure portal instead of Bicep to create the private endpoint for demonstration purposes.
179
179
@@ -222,16 +222,43 @@ At a later stage we will assign an additional role to the VM's managed identity
222
222
Next you will explore and configure the deployed infrastructure.
-[What is Bicep?](/azure/azure-resource-manager/bicep/overview?tabs=bicep)
232
-
-[What are managed identities for Azure resources?](/entra/identity/managed-identities-azure-resources/overview#managed-identity-types)
233
-
-[Enable just-in-time access on VMs](/azure/defender-for-cloud/just-in-time-access-usage)
234
-
-[What is Azure Bastion?](/azure/bastion/bastion-overview)
235
-
-[Microsoft Entra authentication with Azure Database for PostgreSQL - Flexible Server](/azure/postgresql/flexible-server/concepts-azure-ad-authentication)
236
-
-[Use Microsoft Entra ID for authentication with Azure Database for PostgreSQL - Flexible Server](/azure/postgresql/flexible-server/how-to-configure-sign-in-azure-ad-authentication)
237
-
-[Azure Database for PostgreSQL - Flexible Server networking with Private Link](/azure/postgresql/flexible-server/concepts-private-link)
225
+
-[Azure Verified Modules (AVM)][5]
226
+
-[Install Azure CLI][docs-rel-7]
227
+
-[Bicep Documentation][docs-rel-1]
228
+
-[Create a resource group using Azure CLI][docs-rel-8]
Copy file name to clipboardExpand all lines: modules/3-configure-linux-application-workload.md
+14-6Lines changed: 14 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
In this module, you will:
6
6
7
7
- Configure a Linux application workload to connect to an Azure Database for PostgreSQL using a system-assigned managed identity.
8
-
- Connect to the [Azure Virtual Machine using the Azure CLI](/azure/virtual-machines/linux/quick-create-cli).
8
+
- Connect to the [Azure Virtual Machine using the Azure CLI][docs-rel-1].
9
9
- Install the necessary tools.
10
10
- Connect to the PostgreSQL server using `psql`.
11
11
- Clone the repository containing the sample application.
@@ -20,7 +20,7 @@ VM_ID=$(az vm show --resource-group 240900-linux-postgres --name vm-1 --query id
20
20
21
21
## Assign the 'Virtual Machine Administrator Login' role to the user for the VM
22
22
23
-
You can read more about the Privileged role in Azure VMs on the [Azure built-in roles for Privileged](/azure/role-based-access-control/built-in-roles/privileged#role-based-access-control-administrator).
23
+
You can read more about the Privileged role in Azure VMs on the [Azure built-in roles for Privileged][docs-rel-2].
24
24
25
25
```bash
26
26
az role assignment create \
@@ -197,7 +197,15 @@ exit
197
197
```
198
198
199
199
## Resources
200
-
-[Sign in to a Linux virtual machine in Azure using Azure AD](/entra/identity/devices/howto-vm-sign-in-azure-ad-linux)
201
-
-[Connect to an Azure Database for PostgreSQL server using a managed identity](/azure/postgresql/single-server/how-to-connect-with-managed-identity)
202
-
-[Create a Linux virtual machine with the Azure CLI on Azure](/azure/virtual-machines/linux/quick-create-cli).
203
-
-[Azure built-in roles for Privileged](/azure/role-based-access-control/built-in-roles/privileged#role-based-access-control-administrator).
200
+
-[Sign in to a Linux virtual machine in Azure using Azure AD][3]
201
+
-[Connect to an Azure Database for PostgreSQL server using a managed identity][docs-rel-4]
202
+
-[Create a Linux virtual machine with the Azure CLI on Azure][docs-rel-1].
203
+
-[Azure built-in roles for Privileged][docs-rel-2].
0 commit comments