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/azure-functions/functions-how-to-github-actions.md
+22-15Lines changed: 22 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,9 +93,9 @@ You can use the identity of a service principal in Azure when connecting to your
93
93
94
94
### [Docker credentials](#tab/docker-credentials)
95
95
96
-
You need to use registry-specific credentials when deploying a container from a private container registry. For Azure Container Registry (ACR), you can also use the service principal credential.
96
+
You need to use registry-specific credentials when deploying a container from a private container registry. The way that you obtain this credential depends on the container registry. For more information, see [Docker Login Action](https://github.com/marketplace/actions/docker-login#usage).
97
97
98
-
The way that you obtain this credential depends on the container registry. For more information, see [Docker Login Action](https://github.com/marketplace/actions/docker-login#usage).
98
+
For Azure Container Registry (ACR), you can instead use the same service principal credentials you use to deploy to Azure.
99
99
100
100
---
101
101
@@ -205,21 +205,28 @@ The best way to manually create a workflow configuration is to start from the of
205
205
Remember to do the following before you use this YAML file:
206
206
207
207
+ Update the values of `REGISTRY`, `NAMESPACE`, `IMAGE`, and `TAG` based on your container registry.
208
-
+ To use service principal credentials with Azure Container Registry, replace the existing `azure/docker-Login` action with this `docker/login-action`:
+ Update the container respository credentials in the `docker/login-action` action. To use service principal credentials with Azure Container Registry, add an environment variable for the credentials object to your file:
209
+
210
+
```yml
211
+
- env:
212
+
creds: ${{ secrets.AZURE_CREDENTIALS }}
213
+
```
214
+
215
+
Then replace the existing `azure/docker-Login` action with this `docker/login-action`:
216
+
217
+
```yml
218
+
- name: Login to ACR
219
+
uses: docker/login-action@v3
220
+
with:
221
+
registry: <registry-name>.azurecr.io
222
+
username: ${{ fromJson(creds.clientId) }}
223
+
password: ${{ fromJson(creds.clientSecret) }}
224
+
```
218
225
---
219
226
220
227
1. Update the `env.AZURE_FUNCTIONAPP_NAME` parameter with the name of your function app resource in Azure. You may optionally need to update the parameter that sets the language version used by your app, such as `DOTNET_VERSION` for C#.
221
228
222
-
1. To use a service principal credential instead of a publish profile, remove `publish-profile` from the `azure/functions-action` and add this `azure/login` action before `azure/functions-action`:
229
+
1. To connect to your app using service principal credentials instead of a publish profile, remove `publish-profile` from the `azure/functions-action` and add this `azure/login` action before `azure/functions-action`:
223
230
224
231
```yml
225
232
- name: 'Login w/ service principal'
@@ -309,7 +316,7 @@ You can create the GitHub Actions workflow configuration file from the Azure Fun
309
316
310
317
1. In the newly created YAML file, update the `env.AZURE_FUNCTIONAPP_NAME` parameter with the name of your function app resource in Azure. You may optionally need to update the parameter that sets the language version used by your app, such as `DOTNET_VERSION` for C#.
311
318
312
-
1. To use a service principal credential instead of a publish profile, remove `publish-profile` from the `azure/functions-action` and add this `azure/login` action before `azure/functions-action`:
319
+
1. To use service principal credentials instead of a publish profile, remove `publish-profile` from the `azure/functions-action` and add this `azure/login` action before `azure/functions-action`:
313
320
314
321
```yml
315
322
- name: 'Login w/ service principal'
@@ -400,7 +407,7 @@ The following parameters are most commonly used with this action:
400
407
|---------|---------|
401
408
|_**app-name**_ | (Mandatory) The name of your function app. |
402
409
|_**slot-name**_ | (Optional) The name of a specific [deployment slot](functions-deployment-slots.md) you want to deploy to. The slot must already exist in your function app. When not specified, the code is deployed to the active slot. |
403
-
|_**publish-profile**_ | (Optional) The name of the GitHub secret that contains your publish profile. Don't include this if you are instead using a service principal credential with `azure/login`.|
410
+
|_**publish-profile**_ | (Optional) The name of the GitHub secret that contains your publish profile. Don't include this if you are instead using service principal credentials with `azure/login`.|
404
411
405
412
The following parameters are also supported, but are used only in specific cases:
0 commit comments