Samiran Mondal
Samiran Mondal

Reputation: 85

No able to deploy images from ACR to azure function but deployment to web app is working fine using azure pipelines

I am trying to deploy a image from Azure container registry to Azure function using Azure pipelines and its not working, below are my observation:

Azure Function image

2023-07-27T00:01:26.211Z INFO - Pulling image: acrdevintegration.azurecr.io/apiintegtation:1662 2023-07-27T00:01:26.274Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get "https://acrdevintegration.azurecr.io/v2/apiintegtation/manifests/1662": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information."}

2023-07-27T00:01:26.274Z ERROR - Pulling docker image acrdevintegration.azurecr.io/apiintegtation:1662 failed: 2023-07-27T00:01:26.321Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get "https://acrdevintegration.azurecr.io/v2/apiintegtation/manifests/1662": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information."}

2023-07-27T00:01:26.321Z WARN - Image pull failed. Defaulting to local copy if present. 2023-07-27T00:01:26.322Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository) 2023-07-27T00:01:26.323Z INFO - Stopping site azurefunction-dev-integration because it failed during startup.

EDIT 1: enter image description here

enter image description here

Upvotes: 0

Views: 1169

Answers (1)

Samiran Mondal
Samiran Mondal

Reputation: 85

After lot of troubleshooting found the issue. The problem was in the way both the resources were created. The web app was created using the docker image from the ACR( via the Docker tab) , thus the Docker username/password and url got embedded in the configuration when it was started. Thus subsequent deployment to the web app were successful as it contained the ACR credential.

However since azure function does not provide docker tab while creation, I created it without any image. Once created I used the pipeline to deploy my image to the function. Thus the function did not had the ACR credential hence deployment was failing.

Learning:

  • Service connection is responsible only for connecting with the azure function. Not for pulling image from ACR. That the function do it by itself. So never forget to add ACR credential in the configuration setting.
  • The application setting in configuration had those names like DOCKER_REGISTRY_SERVER_URL, PASSWORD AND USERNAME prefilled but the values were empty. I never clicked on Hidden value to check if it actually had those username and password.

enter image description here

Upvotes: 1

Related Questions