skip to Main Content

I experimenting with.net 8 aspire currently.

I am following Microsoft documentation. I did a simple project with Backend api, frontend, and Redis cache.

var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedisContainer("crediscache");

var weatherapi = builder.AddProject<Projects.WeatherApp_Api>("weatherapi");

builder.AddProject<Projects.WeatherApp_Web>("frontend")
    .WithReference(weatherapi)
    .WithReference(cache);

All works fine. By working fine I mean it can deploy everything on the local environment with a Redis container on the docker desktop and when I use the command line azd init, it creates the required infrastructure files and when I run azd up it deploys everything correctly on azure.

But when I AddSqlServerContainer like:

var database = builder.AddSqlServerContainer("database");

It creates the database on the docker desktop but, when I run azd init, it returns an error:

ERROR: unsupported resource type: sqlserver.server.v1

Is this because it is still in preview or is it an azd issue, or is it something wrong I am doing?

I use Visual Studio Enterprise 2022 Preview 17.9.0 Preview 1.0 with the latest azd version "azd version 1.5.0 (commit 012ae734904e0c376ce5074605a6d0d3f05789ee)"

It compiles fine, there are not code issue.

2

Answers


  1. The issue is actually in azd. azd doesn’t support the SqlServer resource type yet, the following azd GitHub issue is tracking implementation:

    https://github.com/Azure/azure-dev/issues/3020

    Login or Signup to reply.
  2. We have made some progress in SQL Server support in preview 2. If you use AddSqlServerContiner(...) we will now add a container.v0 resource to the manifest which azd uses to deploy the application.

    Unfortunately we did not get support for the AddDatabase(...) extension method in azd (which results in a sqlserver.database.v0 resource in the manifest). Which means that options are limited in preview 2.

    In preview 2 we are introducing some variations of the AddX methods which are not quite so container focused and are instead focused on adding the abstract concept of a resource to the app model (so you might use AddSqlServer(...) instead of AddSqlServerContainer(...).

    We did the app model work in preview 2 and we are hoping in preview 3 that we can make progress towards these resource types deploying in azd as managed services such as Azure SQL Database which is more appropriate for production workloads.

    For right now, if you want SQL Server to deployed via azd you would need to use AddSqlServerContainer(...) and not append AddDatabase(...).

    I am hopeful that this information will be obsolete soon 😉

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search