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
Get started with [GitHub Actions](https://docs.github.com/en/actions) by using a workflow to deploy database updates to [Azure Database for MySQL](https://azure.microsoft.com/services/mysql/).
19
19
20
-
21
20
## Prerequisites
22
21
23
22
You will need:
23
+
24
24
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
25
25
- A GitHub repository with sample data (`data.sql`). If you don't have a GitHub account, [sign up for free](https://github.com/join).
26
26
- An Azure Database for MySQL server.
27
-
-[Quickstart: Create an Azure Database for MySQL server in the Azure portal](quickstart-create-mysql-server-database-using-azure-portal.md)
27
+
-[Quickstart: Create an Azure Database for MySQL server in the Azure portal](quickstart-create-mysql-server-database-using-azure-portal.md)
28
28
29
29
## Workflow file overview
30
30
@@ -69,21 +69,23 @@ The output is a JSON object with the role assignment credentials that provide ac
69
69
In the Azure portal, go to your Azure Database for MySQL 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 will look similar to this.
70
70
71
71
> [!IMPORTANT]
72
+
>
72
73
> - For Single server use **Uid=adminusername@servername**. Note the **@servername** is required.
73
74
> - For Flexible server , use **Uid= adminusername** without the @servername.
You will use the connection string as a GitHub secret.
79
81
80
82
## Configure the GitHub secrets
81
83
82
84
1. In [GitHub](https://github.com/), browse your repository.
83
85
84
-
1. Select **Settings > Secrets > New secret**.
86
+
2. Select **Settings > Secrets > New secret**.
85
87
86
-
1. Paste the entire JSON output from the Azure CLI command into the secret's value field. Give the secret the name `AZURE_CREDENTIALS`.
88
+
3. Paste the entire JSON output from the Azure CLI command into the secret's value field. Give the secret the name `AZURE_CREDENTIALS`.
87
89
88
90
When you configure the workflow file later, you use the secret for the input `creds` of the Azure Login action. For example:
89
91
@@ -93,18 +95,17 @@ You will use the connection string as a GitHub secret.
93
95
creds: ${{ secrets.AZURE_CREDENTIALS }}
94
96
```
95
97
96
-
1. Select **New secret** again.
97
-
98
-
1. Paste the connection string value into the secret's value field. Give the secret the name `AZURE_MYSQL_CONNECTION_STRING`.
98
+
4. Select **New secret** again.
99
99
100
+
5. Paste the connection string value into the secret's value field. Give the secret the name `AZURE_MYSQL_CONNECTION_STRING`.
100
101
101
102
## Add your workflow
102
103
103
104
1. Go to **Actions** for your GitHub repository.
104
105
105
106
2. Select **Set up your workflow yourself**.
106
107
107
-
2. Delete everything after the `on:` section of your workflow file. For example, your remaining workflow may look like this.
108
+
3. Delete everything after the `on:` section of your workflow file. For example, your remaining workflow may look like this.
108
109
109
110
```yaml
110
111
name: CI
@@ -116,7 +117,7 @@ You will use the connection string as a GitHub secret.
116
117
branches: [ master ]
117
118
```
118
119
119
-
1. Rename your workflow `MySQL for GitHub Actions` and add the checkout and login actions. These actions will checkout your site code and authenticate with Azure using the `AZURE_CREDENTIALS` GitHub secret you created earlier.
120
+
4. Rename your workflow `MySQL for GitHub Actions` and add the checkout and login actions. These actions will checkout your site code and authenticate with Azure using the `AZURE_CREDENTIALS` GitHub secret you created earlier.
120
121
121
122
```yaml
122
123
name: MySQL for GitHub Actions
@@ -137,7 +138,7 @@ You will use the connection string as a GitHub secret.
137
138
creds: ${{ secrets.AZURE_CREDENTIALS }}
138
139
```
139
140
140
-
1. Use the Azure MySQL Deploy action to connect to your MySQL instance. Replace `MYSQL_SERVER_NAME` with the name of your server. You should have a MySQL data file named `data.sql` at the root level of your repository.
141
+
5. Use the Azure MySQL Deploy action to connect to your MySQL instance. Replace `MYSQL_SERVER_NAME` with the name of your server. You should have a MySQL data file named `data.sql` at the root level of your repository.
141
142
142
143
```yaml
143
144
- uses: azure/mysql@v1
@@ -147,7 +148,7 @@ You will use the connection string as a GitHub secret.
147
148
sql-file: './data.sql'
148
149
```
149
150
150
-
1. Complete your workflow by adding an action to logout of Azure. Here is the completed workflow. The file will appear in the `.github/workflows` folder of your repository.
151
+
6. Complete your workflow by adding an action to logout of Azure. Here is the completed workflow. The file will appear in the `.github/workflows` folder of your repository.
151
152
152
153
```yaml
153
154
name: MySQL for GitHub Actions
@@ -157,32 +158,32 @@ You will use the connection string as a GitHub secret.
0 commit comments