Using Azure Container Registry creating new Azure Container Instance from C# Using Azure Container Registry creating new Azure Container Instance from C# azure azure

Using Azure Container Registry creating new Azure Container Instance from C#


The answer above (ie using full azure registry server name):

.WithImage("mytestreg.azurecr.io/mytestimage:latest")

seems to be part of the solution, but even with that change I was still seeing this error. Looking through other examples on the web (https://github.com/Azure-Samples/aci-dotnet-create-container-groups-using-private-registry/blob/master/Program.cs) containing what I needed, I changed my azure authentication from:

azure = Azure.Authenticate(authFilePath).WithDefaultSubscription();

to:

AzureCredentials credentials = SdkContext.AzureCredentialsFactory.FromFile(authFilePath);azure = Azure    .Configure()    .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)    .Authenticate(credentials)    .WithDefaultSubscription();

and with THAT change, things are now working correctly.


I had the same problems for the last couple of weeks and I've finally found a solution. You should add your azure registry server name in front of the image name. So following your example change:

.WithImage("mytestimage/latest")

To:

.WithImage("mytestreg.azurecr.io/mytestimage:latest")

At least that did it for me, I hope it helps someone else.