microsoft / microsoft/aspire

Improve handling of `azd deploy` auth errors

Open
#8,805 5 comments 0 reactions 0 assignees View on GitHub
area-deployment
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

When `azd deploy` fails to push blobs because, for example, the underlying token expired
It would be nice having a clear "authentication failed" error, or even better an authentication prompt.

Error example:

> ERROR: failed deploying service 'foobar': publishing container: dotnet publish on project 'FooBar/FooBar.csproj' failed: exit code: 1, stdout: {"config":{"ExposedPorts":{"8080/tcp":{}},"Labels":{"org.opencontainers.image.created":"2025-04-16T01:09:48.5105780Z","org.opencontainers.artifact.created":"2025-04-16T01:09:48.5105780Z","org.opencontainers.image.authors":"FooBar","org.opencontainers.image.version":"1.0.0","org.opencontainers.image.base.name":"mcr.microsoft.com/dotnet/aspnet:9.0","net.dot.runtime.majorminor":"9.0","net.dot.sdk.version":"9.0.202","org.opencontainers.image.base.digest":"sha256:a34223e6d123f65cf9b3097b74e123fc3062ac189f123bce0303d123814e19ca"},"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","APP_UID=1654","ASPNETCORE_HTTP_PORTS=8080","DOTNET_RUNNING_IN_CONTAINER=true","DOTNET_VERSION=9.0.4","ASPNET_VERSION=9.0.4"],"WorkingDir":"/app/","Entrypoint":["dotnet","/app/FooBar.dll"],"User":"1654"},"created":"2025-04-16T01:09:50.3943070Z","rootfs":{"type":"layers","diff_ids":["sha256:ab123fbff095473bb8a6c867938d6d851e11ef0c177fce983eee83440123cd72","sha256:123d43cd8e31db12e9e0d91b36d8f59ef12315fc96b07efa6514f7097816bb65","sha256:81ca6e85712b73dda47534b18743796049c5123648729d129929432e42eb7ed6","sha256:f702708b44449c004184053ba22fefc2c7ac5cdfcc781946eb3873b4e3b9110f","sha256:23e62587361a6ab14b9fe9df81c13dacd401230dcb17d1fe2718224edbc7d76e","sha256:63740d600de2a90f508ee68d112f1e3ab49868eb1af72cce9e2f425a1b41733e","sha256:6785ad6223d0ef22b0a3a01f11f8ce78e0effbf7921b94f1248ee3d67d56eb11"]},"architecture":"amd64","os":"linux","history":[{"comment":"debuerreotype 0.15","created":"2025-04-07T00:00:00.0000000Z","created_by":"# debian.sh --arch \u0027amd64\u0027 out/ \u0027bookworm\u0027 \u0027@1743984000\u0027"},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:14:44.7567049Z","created_by":"ENV APP_UID=1654 ASPNETCORE_HTTP_PORTS=8080 DOTNET_RUNNING_IN_CONTAINER=true","empty_layer":true},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:14:44.7567049Z","created_by":"RUN /bin/sh -c apt-get update \u0026\u0026 apt-get install -y --no-install-recommends ca-certificates libc6 libgcc-s1 libicu72 libssl3 libstdc\u002B\u002B6 tzdata \u0026\u0026 rm -rf /var/lib/apt/lists/* # buildkit"},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:14:46.5873049Z","created_by":"RUN /bin/sh -c groupadd --gid=$APP_UID app \u0026\u0026 useradd -l --uid=$APP_UID --gid=$APP_UID --create-home app # buildkit"},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:14:54.2377701Z","created_by":"ENV DOTNET_VERSION=9.0.4","empty_layer":true},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:14:54.2377701Z","created_by":"COPY /dotnet /usr/share/dotnet # buildkit"},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:14:55.4476651Z","created_by":"RUN /bin/sh -c ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet # buildkit"},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:15:02.8956269Z","created_by":"ENV ASPNET_VERSION=9.0.4","empty_layer":true},{"comment":"buildkit.dockerfile.v0","created":"2025-04-08T18:15:02.8956269Z","created_by":"COPY /dotnet /usr/share/dotnet # buildkit"},{"author":".NET SDK","created":"2025-04-16T01:09:50.3942830Z","created_by":".NET SDK Container Tooling, version 9.0.202-servicing.25161.14\u002B3a53853c30324c4732f8ccee07b55d2d97f94d82"}]}
> , stderr: /usr/local/share/dotnet/sdk/9.0.202/Containers/build/Microsoft.NET.Build.Containers.targets(252,5): error CONTAINER1013: Failed to push to the output registry: CONTAINER1001: Failed to upload blob using POST https://acr1234abcabc123.azurecr.io/v2/aspire-apphost/some-rg/blobs/uploads/; received status code 'Unauthorized'. [FooBar/FooBar.csproj]

### Describe the solution you'd like

Option 1: show a more prominent error message before the long blurb, e.g.: "Unable to upload, not authorized"
Option 2: kick off an authentication flow if possible, so the process can complete

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.