Muokkaa

Jaa


Read real time app data with .NET Aspire Dashboard in Azure Container Apps (preview)

The .NET Aspire Dashboard displays live data about how applications and other resources are running within an environment.

The following image is a screenshot of a trace visualization generated by the .NET Aspire Dashboard.

Screenshot of a .NET Aspire Dashboard trace window.

The information displayed on the dashboard comes from two sources:

  • OpenTelemetry (OTel), an open-source library for tracking traces, metrics, and logs for your applications. This documentation provides more information on how the Aspire dashboard integrates with OTel.

    • Traces track the lifecycle of requests - how a request is received and processed as it moves between different parts of the application. This information is useful for identifying bottlenecks and other issues.
    • Metrics are real-time measurements of the general health and performance of the infrastructure - for example, how many CPU resources are consumed and how many transactions that the application handles per second. This information is useful for understanding the responsiveness of your app or identifying early warning signs of performance issues.
    • Logs record all events and errors that take place during the running of the application. This information is useful for finding when a problem occurred and correlated events.
  • The Kubernetes API provides information about the underlying Kubernetes pods on which your application is running on and their logs.

The dashboard is secured against unauthorized access and modification. To use the dashboard, a user must have 'Write' permissions or higher - in other words, they must be a Contributor or Owner on the environment.

Enable the dashboard

Tip

While you have the portal as an option, the recommended approach to enabling your dashboard is with azd. If you run into an problems using the portal, create an issue in the Container Apps GitHub repo.

You can enable the .NET Aspire Dashboard on any existing container app using the following steps.

  1. Go to the Azure portal.

  2. Open the Overview window of your container app.

  3. Find the .NET Aspire Dashboard label, and select the enable link.

    This action opens the .NET Aspire Dashboard settings window.

  4. Next to the .NET Aspire Dashboard label, select the Enabled checkbox.

    Now the .NET Aspire Dashboard URL is displayed to you.

  5. Select the URL to your dashboard.

You can enable the .NET Aspire Dashboard on any existing container app environment by using the following commands.

az containerapp env dotnet-component create \
  --environment <ENVIRONMENT_NAME> \
  --name <CONTAINER_APP_NAME> \
  --resource-group <RESOURCE_GROUP_NAME>

The create command returns the dashboard URL that you can open in a browser.

You can enable the .NET Aspire Dashboard on any existing container app using the following steps.

dotnet new aspire-starter
azd init --location westus2
azd config set aspire.dashboard on
azd up

The up command returns the dashboard URL that you can open in a browser.

Troubleshooting

Refer to the following items if you have issues enabling your dashboard:

  • The portal can take up to two minutes for the dashboard to activate. If you try to go to the dashboard before it's ready, the server returns a 404 or 421 error.

  • If you encounter a 421 "Misdirected Request" error, close the browser window, wait a few minutes, and try again.

  • You might receive an authentication error when accessing the dashboard that reads, "Could not authenticate user with requested resource."

    This issue occurs because security group permissions do not propagate to the Container App Environment. To solve this problem, make sure you explicitly give yourself a Contributor or Owner role on your Container Apps environment. This can be done through the following steps:

    • Navigate to the Resource:
      • Open the Azure Portal and search for your container app environment.
    • Access the Access Control (IAM) Blade:
      • Click on Access Control (IAM) for the container app environment.
    • Verify Existing Role Assignments:
      • Check if you (or your account) are assigned any roles. Note that permissions do not currently propagate through security groups.
      • If you are not, follow the remaining steps to assign the role.
    • Explicit Role Assignment: - Click Add > Add role assignment. - Choose Role: Either Contributor or Owner, as appropriate for your required access level. - Assign the role explicitly to your user account (e.g., youremail@domain.com).
    • Save and Confirm:
      • Save the changes. Ensure the role is visible under the Role Assignments section.
    • Verify Dashboard Access:
      • Test by attempting to access the Aspire dashboard. If you continue to get the error, please reach out to our team.

.NET Aspire dashboard overview