0

I'm trying to run a set of Azure functions using .NET 6 and dotnet-isolated. When run locally the Program.cs/Main method is correctly invoked. When published to Azure the Program.cs/Main method is never called (which results in failures because DI isn't initialized).

My local.settings.json looks like:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
    "FUNCTIONS_EXTENSION_VERSION": "~4"
  }
}

On the Azure portal, looking at the live stream, I can see the following:

2022-01-06T18:38:22.618Z INFO  - Starting container for site
2022-01-06T18:38:22.619Z INFO  - docker run -d -p 8081:8081 --name lolnotsofast_0_b59188ad_msiProxy -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=lolnotsofast.azurewebsites.net -e WEBSITE_INSTANCE_ID=[lots of hex] appsvc/msitokenservice:[some #s]  

2022-01-06T18:38:22.619Z INFO  - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.

2022-01-06T18:38:28.950Z INFO  - Pulling image from Docker hub: mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated5.0-appservice-stage6
2022-01-06T18:38:29.127Z ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"manifest for mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated5.0-appservice-stage6 not found: manifest unknown: manifest tagged by \"4-dotnet-isolated5.0-appservice-stage6\" is not found"}

2022-01-06T18:38:29.128Z WARN  - Image pull failed. Defaulting to local copy if present.
2022-01-06T18:38:29.130Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)

2022-01-06T18:38:41.279Z INFO  - Stopping site cca-amznintegration-d-func because it failed during startup.

The crux of the issue appears to be that this container image, mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated5.0-appservice-stage6, is not known.

I have no idea where/how this name is divined or what it means.

Any ideas on how to proceed from here?

Thanks!

user2845090
  • 147
  • 3
  • 14

1 Answers1

1

To pull the docker images from the Azure Container Registry, need to be set the environment variables like below:

Using Azure Portal:

enter image description here

Using Azure CLI: Azure CLI command az functionapp create with the parameters:

--deployment-container-image-name
--docker-registry-server-password
--docker-registry-server-user

enter image description here

If not resolved, Please follow the below steps:

  1. Enable Admin Access in the Azure Container Registry.
  2. Add a contributor role to app service in IAM Control menu (if app service is not reflecting, go to your app service > identity section > change the status of system identity to ON) and Restart the App Service.

Reference:

  1. Azure Functions Create Config Env Variables
  2. Azure AppServices fails pulling an image while it is confirmed to be present in ACR by CLI · Issue #124 · Azure/acr (github.com)
  • I'm not publishing the functions using a container registry. Is .net 6 out-of-process only supported if publishing to "Azure function app container"? I can't just publish to "Azure function app (linux)"? – user2845090 Jan 07 '22 at 11:39
  • https://i.imgur.com/kR0KpNq.png - I'm able to publish my .net 6 Isolated function app to Linux successfully –  Jan 07 '22 at 12:14