Skip to content

Commit d1718c2

Browse files
committed
update README with SPN auth
1 parent 4e46210 commit d1718c2

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

README.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,37 @@ The following example updates the configuration of a NGINX deployment in Azure e
88

99
### Sample workflow that authenticates with Azure using Azure Service Principal with a secret
1010

11-
To be added
11+
```yaml
12+
# File: .github/workflows/nginxForAzureDeploy.yml
13+
14+
name: Sync configuration to NGINX for Azure
15+
on:
16+
push:
17+
branches:
18+
- main
19+
paths:
20+
- config/**
21+
22+
jobs:
23+
Deploy-NGINX-Configuration:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: 'Checkout repository'
27+
uses: actions/checkout@v2
28+
29+
- name: 'Run Azure Login with OIDC'
30+
uses: azure/login@v1
31+
with:
32+
creds: ${{ secrets.AZURE_CREDENTIALS }}
33+
34+
- name: 'Sync NGINX configuration to NGINX on Azure instance'
35+
uses: nginxinc/nginx-for-azure-deploy-action@v1
36+
with:
37+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
38+
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
39+
nginx-deployment-name: ${{ secrets.NGINX_DEPLOYMENT_NAME }}
40+
nginx-config-file-path: ${{ secrets.NGINX_CONFIG_FILE }}
41+
```
1242
1343
### Sample workflow that authenticates with Azure using OIDC
1444
@@ -27,14 +57,6 @@ permissions:
2757
id-token: write
2858
contents: read
2959

30-
env:
31-
AZURE_TENANT_ID: '<The Azure Active Directory tenant ID>'
32-
AZURE_CLIENT_ID: '<The client ID of the Azure Service Principal to perform the deployment>'
33-
AZURE_SUBSCRIPTION_ID: '<The Azure subscription ID of the NGINX deployment>'
34-
AZURE_RESOURCE_GROUP_NAME: '<The resource group of the NGINX deployment>'
35-
NGINX_DEPLOYMENT_NAME: '<The name of the NGINX deployment>'
36-
NGINX_CONFIG_FILE: '<The relative path of the configuration file in the repository>'
37-
3860
jobs:
3961
Deploy-NGINX-Configuration:
4062
runs-on: ubuntu-latest
@@ -45,14 +67,15 @@ jobs:
4567
- name: 'Run Azure Login with OIDC'
4668
uses: azure/login@v1
4769
with:
48-
client-id: ${{ env.AZURE_CLIENT_ID }}
49-
tenant-id: ${{ env.AZURE_TENANT_ID }}
50-
subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
70+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
71+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
72+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
5173

5274
- name: 'Sync NGINX configuration to NGINX on Azure instance'
5375
uses: nginxinc/nginx-for-azure-deploy-action@v1
5476
with:
55-
subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
56-
resource-group-name: ${{ env.AZURE_RESOURCE_GROUP_NAME }}
57-
nginx-deployment-name: ${{ env.NGINX_DEPLOYMENT_NAME }}
58-
nginx-config-file-path: ${{ env.NGINX_CONFIG_FILE }}
77+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
78+
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
79+
nginx-deployment-name: ${{ secrets.NGINX_DEPLOYMENT_NAME }}
80+
nginx-config-file-path: ${{ secrets.NGINX_CONFIG_FILE }}
81+
```

0 commit comments

Comments
 (0)