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: articles/load-testing/tutorial-cicd-github-actions.md
+29-3Lines changed: 29 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,11 +56,11 @@ The sample application's source repo includes an Apache JMeter script named *Sam
56
56
57
57
## Set up GitHub access permissions for Azure
58
58
59
-
In this section, you'll configure your GitHub repository to have permissions for accessing the Azure Load Testing resource.
59
+
The GitHub Actions workflow needs to authenticate with Azure to access Azure resources. In the sample application, you use the [Azure Login](https://github.com/Azure/login) action and an Azure Active Directory service principal to authenticate with Azure.
60
60
61
-
To access Azure resources, you'll create an Azure Active Directory service principal and use role-based access control to assign the necessary permissions.
61
+
In this section, you'll configure your GitHub repository to have permissions to access your Azure load testing resource:
62
62
63
-
1. Run the following Azure CLI command to create a service principal:
63
+
1. Run the following Azure CLI command to create a service principal and assign the Contributor role:
64
64
65
65
```azurecli
66
66
az ad sp create-for-rbac --name "my-load-test-cicd" --role contributor \
@@ -82,8 +82,13 @@ To access Azure resources, you'll create an Azure Active Directory service princ
82
82
}
83
83
```
84
84
85
+
> [!NOTE]
86
+
> Azure Login supports multiple ways to authenticate with Azure. For other authentication options, see the [Azure and GitHub integration site](/azure/developer/github).
87
+
85
88
1. Go to your forked GitHub repository for the sample application.
86
89
90
+
You'll add a GitHub secret to your repository for the service principal you created in the previous step. The Azure Login action uses this secret to authenticate with Azure.
91
+
87
92
1. Add a new secret to your GitHub repository by selecting **Settings** > **Secrets** > **New repository secret**.
88
93
89
94
:::image type="content" source="./media/tutorial-cicd-github-actions/github-new-secret.png" alt-text="Screenshot that shows selections for adding a new repository secret to your GitHub repo.":::
@@ -108,6 +113,27 @@ To access Azure resources, you'll create an Azure Active Directory service princ
108
113
--subscription "<subscription-name-or-id>"
109
114
```
110
115
116
+
You can now use the `AZURE_CREDENTIALS` secret with the Azure Login action in your CI/CD workflow. The following code snippet describes how this works for the sample application:
117
+
118
+
```yml
119
+
jobs:
120
+
build-and-deploy:
121
+
# The type of runner that the job will run on
122
+
runs-on: ubuntu-latest
123
+
124
+
# Steps represent a sequence of tasks that will be executed as part of the job
125
+
steps:
126
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
127
+
- name: Checkout GitHub Actions
128
+
uses: actions/checkout@v2
129
+
130
+
- name: Login to Azure
131
+
uses: azure/login@v1
132
+
continue-on-error: false
133
+
with:
134
+
creds: ${{ secrets.AZURE_CREDENTIALS }}
135
+
```
136
+
111
137
## Configure the GitHub Actions workflow to run a load test
112
138
113
139
In this section, you'll set up a GitHub Actions workflow that triggers the load test. The sample application repository contains a workflow file *SampleApp.yaml*. The workflow first deploys the sample web application to Azure App Service, and then invokes the load test. The GitHub action uses an environment variable to pass the URL of the web application to the Apache JMeter script.
0 commit comments