Skip to content

Commit f236991

Browse files
committed
Fixes to the YAML
1 parent 197e9b2 commit f236991

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

articles/azure-functions/functions-how-to-github-actions.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ You can use the identity of a service principal in Azure when connecting to your
9393
9494
### [Docker credentials](#tab/docker-credentials)
9595
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).
9797
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.
9999
100100
---
101101
@@ -205,21 +205,28 @@ The best way to manually create a workflow configuration is to start from the of
205205
Remember to do the following before you use this YAML file:
206206
207207
+ 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`:
209-
210-
```yml
211-
- name: Login to ACR
212-
uses: docker/login-action@v3
213-
with:
214-
registry: <registry-name>.azurecr.io
215-
username: ${{ secrets.AZURE_CREDENTIALS.clientId }}
216-
password: ${{ secrets.AZURE_CREDENTIALS.clientSecret }}
217-
```
208+
+ 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+
```
218225
---
219226
220227
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#.
221228
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`:
223230
224231
```yml
225232
- name: 'Login w/ service principal'
@@ -309,7 +316,7 @@ You can create the GitHub Actions workflow configuration file from the Azure Fun
309316
310317
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#.
311318
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`:
313320
314321
```yml
315322
- name: 'Login w/ service principal'
@@ -400,7 +407,7 @@ The following parameters are most commonly used with this action:
400407
|---------|---------|
401408
|_**app-name**_ | (Mandatory) The name of your function app. |
402409
|_**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`.|
404411
405412
The following parameters are also supported, but are used only in specific cases:
406413

0 commit comments

Comments
 (0)