Skip to content

Commit 678ceb1

Browse files
committed
script update to address syntax issues
1 parent 5d13db2 commit 678ceb1

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

articles/mysql/quickstart-mysql-github-actions.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: juliakm
55
ms.service: mysql
66
ms.topic: quickstart
77
ms.author: jukullam
8-
ms.date: 10/12/2020
8+
ms.date: 02/14/2022
99
ms.custom: github-actions-azure, mode-other
1010
---
1111

@@ -17,14 +17,14 @@ ms.custom: github-actions-azure, mode-other
1717

1818
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/).
1919

20-
2120
## Prerequisites
2221

2322
You will need:
23+
2424
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2525
- A GitHub repository with sample data (`data.sql`). If you don't have a GitHub account, [sign up for free](https://github.com/join).
2626
- 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)
2828

2929
## Workflow file overview
3030

@@ -69,21 +69,23 @@ The output is a JSON object with the role assignment credentials that provide ac
6969
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.
7070

7171
> [!IMPORTANT]
72+
>
7273
> - For Single server use **Uid=adminusername@servername**. Note the **@servername** is required.
7374
> - For Flexible server , use **Uid= adminusername** without the @servername.
7475
7576
```output
7677
Server=my-mysql-server.mysql.database.azure.com; Port=3306; Database={your_database}; Uid=adminname@my-mysql-server; Pwd={your_password}; SslMode=Preferred;
7778
```
79+
7880
You will use the connection string as a GitHub secret.
7981

8082
## Configure the GitHub secrets
8183

8284
1. In [GitHub](https://github.com/), browse your repository.
8385

84-
1. Select **Settings > Secrets > New secret**.
86+
2. Select **Settings > Secrets > New secret**.
8587

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`.
8789

8890
When you configure the workflow file later, you use the secret for the input `creds` of the Azure Login action. For example:
8991

@@ -93,18 +95,17 @@ You will use the connection string as a GitHub secret.
9395
creds: ${{ secrets.AZURE_CREDENTIALS }}
9496
```
9597
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.
9999
100+
5. Paste the connection string value into the secret's value field. Give the secret the name `AZURE_MYSQL_CONNECTION_STRING`.
100101

101102
## Add your workflow
102103

103104
1. Go to **Actions** for your GitHub repository.
104105

105106
2. Select **Set up your workflow yourself**.
106107

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.
108109

109110
```yaml
110111
name: CI
@@ -116,7 +117,7 @@ You will use the connection string as a GitHub secret.
116117
branches: [ master ]
117118
```
118119

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.
120121

121122
```yaml
122123
name: MySQL for GitHub Actions
@@ -137,7 +138,7 @@ You will use the connection string as a GitHub secret.
137138
creds: ${{ secrets.AZURE_CREDENTIALS }}
138139
```
139140

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.
141142

142143
```yaml
143144
- uses: azure/mysql@v1
@@ -147,7 +148,7 @@ You will use the connection string as a GitHub secret.
147148
sql-file: './data.sql'
148149
```
149150

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.
151152

152153
```yaml
153154
name: MySQL for GitHub Actions
@@ -157,32 +158,32 @@ You will use the connection string as a GitHub secret.
157158
branches: [ master ]
158159
pull_request:
159160
branches: [ master ]
160-
jobs:
161+
jobs:
161162
build:
162163
runs-on: windows-latest
163164
steps:
164-
- uses: actions/checkout@v1
165-
- uses: azure/login@v1
165+
- uses: actions/checkout@v1
166+
- uses: azure/login@v1
166167
with:
167-
creds: ${{ secrets.AZURE_CREDENTIALS }}
168+
creds: ${{ secrets.AZURE_CREDENTIALS }}
168169
169-
- uses: azure/mysql@v1
170+
- uses: azure/mysql@v1
170171
with:
171-
server-name: MYSQL_SERVER_NAME
172-
connection-string: ${{ secrets.AZURE_MYSQL_CONNECTION_STRING }}
173-
sql-file: './data.sql'
172+
server-name: MYSQL_SERVER_NAME
173+
connection-string: ${{ secrets.AZURE_MYSQL_CONNECTION_STRING }}
174+
sql-file: './data.sql'
174175
175176
# Azure logout
176-
- name: logout
177+
- name: logout
177178
run: |
178-
az logout
179+
az logout
179180
```
180181

181182
## Review your deployment
182183

183184
1. Go to **Actions** for your GitHub repository.
184185

185-
1. Open the first result to see detailed logs of your workflow's run.
186+
2. Open the first result to see detailed logs of your workflow's run.
186187

187188
:::image type="content" source="media/quickstart-mysql-github-actions/github-actions-run-mysql.png" alt-text="Log of GitHub actions run":::
188189

0 commit comments

Comments
 (0)