Skip to content

Commit ea20c7b

Browse files
Merge pull request #236343 from markingmyname/pgclean
[PostgreSQL] Clean up includes on file
2 parents 3712482 + c97ca8e commit ea20c7b

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

articles/postgresql/single-server/how-to-deploy-github-action.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
---
2-
title: 'Quickstart: Connect to Azure PostgreSQL with GitHub Actions'
2+
title: "Quickstart: Connect to Azure PostgreSQL with GitHub Actions"
33
description: Use Azure PostgreSQL from a GitHub Actions workflow
4+
author: sunilagarwal
5+
ms.author: sunila
6+
ms.reviewer: maghan
7+
ms.date: 04/28/2023
48
ms.service: postgresql
59
ms.subservice: single-server
610
ms.topic: quickstart
7-
ms.author: sunila
8-
author: sunilagarwal
9-
ms.reviewer: ""
10-
ms.custom: github-actions-azure, mode-other
11-
ms.date: 02/15/2023
11+
ms.custom:
12+
- github-actions-azure
13+
- mode-other
1214
---
1315

1416
# Quickstart: Use GitHub Actions to connect to Azure PostgreSQL
1517

16-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
18+
[!INCLUDE [applies-to-postgresql-single-flexible-server](../includes/applies-to-postgresql-single-flexible-server.md)]
1719

1820
[!INCLUDE [azure-database-for-postgresql-single-server-deprecation](../includes/azure-database-for-postgresql-single-server-deprecation.md)]
1921

20-
**APPLIES TO:** :::image type="icon" source="./media/applies-to/yes.png" border="false":::Azure Database for PostgreSQL - Single Server :::image type="icon" source="./media/applies-to/yes.png" border="false":::Azure Database for PostgreSQL - Flexible Server
21-
2222
Get started with [GitHub Actions](https://docs.github.com/en/actions) by using a workflow to deploy database updates to [Azure Database for PostgreSQL](https://azure.microsoft.com/services/postgresql/).
2323

2424
## Prerequisites
2525

26-
You'll need:
26+
You need:
27+
2728
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2829
- A GitHub repository with sample data (`data.sql`). If you don't have a GitHub account, [sign up for free](https://github.com/join).
2930
- An Azure Database for PostgreSQL server.
@@ -35,10 +36,10 @@ A GitHub Actions workflow is defined by a YAML (.yml) file in the `/.github/work
3536

3637
The file has two sections:
3738

38-
|Section |Tasks |
39-
|---------|---------|
40-
|**Authentication** | 1. Generate deployment credentials. |
41-
|**Deploy** | 1. Deploy the database. |
39+
| Section | Tasks |
40+
| --- | --- |
41+
| **Authentication** | 1. Generate deployment credentials. |
42+
| **Deploy** | 1. Deploy the database. |
4243

4344
## Generate deployment credentials
4445

@@ -48,15 +49,15 @@ The file has two sections:
4849

4950
In the Azure portal, go to your Azure Database for PostgreSQL server and open **Settings** > **Connection strings**. Copy the **ADO.NET** connection string. Replace the placeholder values for `your_database` and `your_password`. The connection string looks similar to this.
5051

51-
> [!IMPORTANT]
52+
> [!IMPORTANT]
5253
> - For Single server use ```user=adminusername@servername``` . Note the ```@servername``` is required.
5354
> - For Flexible server , use ```user= adminusername``` without the ```@servername```.
5455
5556
```output
5657
psql host={servername.postgres.database.azure.com} port=5432 dbname={your_database} user={adminusername} password={your_database_password} sslmode=require
5758
```
5859

59-
You'll use the connection string as a GitHub secret.
60+
You use the connection string as a GitHub secret.
6061

6162
## Configure the GitHub secrets
6263

@@ -66,9 +67,9 @@ You'll use the connection string as a GitHub secret.
6667

6768
1. Go to **Actions** for your GitHub repository.
6869

69-
2. Select **Set up your workflow yourself**.
70+
1. Select **Set up your workflow yourself**.
7071

71-
2. Delete everything after the `on:` section of your workflow file. For example, your remaining workflow may look like this.
72+
1. Delete everything after the `on:` section of your workflow file. For example, your remaining workflow may look like this.
7273

7374
```yaml
7475
name: CI
@@ -80,7 +81,7 @@ You'll use the connection string as a GitHub secret.
8081
branches: [ main ]
8182
```
8283
83-
1. Rename your workflow `PostgreSQL for GitHub Actions` and add the checkout and login actions. These actions check out your site code and authenticate with Azure using the GitHub secret(s) you created earlier.
84+
1. Rename your workflow `PostgreSQL for GitHub Actions` and add the checkout and sign in actions. These actions check out your site code and authenticate with Azure using the GitHub secret(s) you created earlier.
8485

8586
# [Service principal](#tab/userlevel)
8687

@@ -102,6 +103,7 @@ You'll use the connection string as a GitHub secret.
102103
with:
103104
creds: ${{ secrets.AZURE_CREDENTIALS }}
104105
```
106+
105107
# [OpenID Connect](#tab/openid)
106108

107109
```yaml
@@ -124,9 +126,10 @@ You'll use the connection string as a GitHub secret.
124126
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
125127
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
126128
```
129+
127130
---
128131

129-
2. Use the Azure PostgreSQL Deploy action to connect to your PostgreSQL instance. Replace `POSTGRESQL_SERVER_NAME` with the name of your server. You should have a PostgreSQL data file named `data.sql` at the root level of your repository.
132+
1. Use the Azure PostgreSQL Deploy action to connect to your PostgreSQL instance. Replace `POSTGRESQL_SERVER_NAME` with the name of your server. You should have a PostgreSQL data file named `data.sql` at the root level of your repository.
130133

131134
```yaml
132135
- uses: azure/postgresql@v1
@@ -136,7 +139,7 @@ You'll use the connection string as a GitHub secret.
136139
plsql-file: './data.sql'
137140
```
138141

139-
3. Complete your workflow by adding an action to logout of Azure. Here's the completed workflow. The file appears in the `.github/workflows` folder of your repository.
142+
1. Complete your workflow by adding an action to sign out of Azure. Here's the completed workflow. The file appears in the `.github/workflows` folder of your repository.
140143

141144
# [Service principal](#tab/userlevel)
142145

@@ -205,16 +208,16 @@ You'll use the connection string as a GitHub secret.
205208
run: |
206209
az logout
207210
```
208-
---
209211

212+
---
210213

211214
## Review your deployment
212215

213216
1. Go to **Actions** for your GitHub repository.
214217

215218
1. Open the first result to see detailed logs of your workflow's run.
216219

217-
:::image type="content" source="media/how-to-deploy-github-action/gitbub-action-postgres-success.png" alt-text="Log of GitHub Actions run":::
220+
:::image type="content" source="media/how-to-deploy-github-action/gitbub-action-postgres-success.png" alt-text="Log of GitHub Actions run" lightbox="media/how-to-deploy-github-action/gitbub-action-postgres-success.png":::
218221

219222
## Clean up resources
220223

0 commit comments

Comments
 (0)