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
**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
-
22
22
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/).
23
23
24
24
## Prerequisites
25
25
26
-
You'll need:
26
+
You need:
27
+
27
28
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
28
29
- A GitHub repository with sample data (`data.sql`). If you don't have a GitHub account, [sign up for free](https://github.com/join).
29
30
- 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
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.
50
51
51
-
> [!IMPORTANT]
52
+
> [!IMPORTANT]
52
53
> - For Single server use ```user=adminusername@servername``` . Note the ```@servername``` is required.
53
54
> - For Flexible server , use ```user= adminusername``` without the ```@servername```.
You'll use the connection string as a GitHub secret.
60
+
You use the connection string as a GitHub secret.
60
61
61
62
## Configure the GitHub secrets
62
63
@@ -66,9 +67,9 @@ You'll use the connection string as a GitHub secret.
66
67
67
68
1. Go to **Actions** for your GitHub repository.
68
69
69
-
2. Select **Set up your workflow yourself**.
70
+
1. Select **Set up your workflow yourself**.
70
71
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.
72
73
73
74
```yaml
74
75
name: CI
@@ -80,7 +81,7 @@ You'll use the connection string as a GitHub secret.
80
81
branches: [ main ]
81
82
```
82
83
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.
84
85
85
86
# [Service principal](#tab/userlevel)
86
87
@@ -102,6 +103,7 @@ You'll use the connection string as a GitHub secret.
102
103
with:
103
104
creds: ${{ secrets.AZURE_CREDENTIALS }}
104
105
```
106
+
105
107
# [OpenID Connect](#tab/openid)
106
108
107
109
```yaml
@@ -124,9 +126,10 @@ You'll use the connection string as a GitHub secret.
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.
130
133
131
134
```yaml
132
135
- uses: azure/postgresql@v1
@@ -136,7 +139,7 @@ You'll use the connection string as a GitHub secret.
136
139
plsql-file: './data.sql'
137
140
```
138
141
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.
140
143
141
144
# [Service principal](#tab/userlevel)
142
145
@@ -205,16 +208,16 @@ You'll use the connection string as a GitHub secret.
205
208
run: |
206
209
az logout
207
210
```
208
-
---
209
211
212
+
---
210
213
211
214
## Review your deployment
212
215
213
216
1. Go to **Actions** for your GitHub repository.
214
217
215
218
1. Open the first result to see detailed logs of your workflow's run.
216
219
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":::
0 commit comments