title: Failing to update database schema using Entity Framework CLI
body: <p>I have created an empty <code>dotnet new webapi</code> project on my machine using .NET CLI. I have setup <code>ApplicationDbContext</code> as well as a connection string in <code>appsettings.json</code> and created a model that I would like to create in the database.</p>
  <p>The project successfully builds and when run the command</p>
  <pre><code>dotnet ef migrations add InitialCreate
  </code></pre>
  <p>it generates the <code>Migrations</code> folder with the migration script in it.</p>
  <p>The problem arises when running the script and updating the database using the <code>dotnet ef database update</code> where it throws the following error:</p>
  <blockquote>
  <p>Entity Framework Core 6.0.6 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer:6.0.6' with options: None ...<br />
  ...<br />
  ...<br />
  ClientConnectionId:#@#@#@@-####-####-@###-#@#@#@#@<br />
  Error Number:18456,State:1,Class:14<br />
  Login failed for user 'abc###\Guest'.</p>
  </blockquote>
  <p>I am not sure why it is throwing this error and how it can be fixed.</p>
  <p><code>appsettings.json</code>:</p>
  <pre><code>{
    &quot;Logging&quot;: {
      &quot;LogLevel&quot;: {
        &quot;Default&quot;: &quot;Information&quot;,
        &quot;Microsoft.AspNetCore&quot;: &quot;Warning&quot;
      }
    },
    &quot;AllowedHosts&quot;: &quot;*&quot;,
    &quot;ConnectionStrings&quot;: {
      &quot;DefaultConnection&quot;: &quot;Server=localhost;Database=BookClub;Trusted_Connection=True;&quot;
    }
  }
  </code></pre>
  <p><code>BoockClub.csproj</code>:</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.Web&quot;&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;net6.0&lt;/TargetFramework&gt;
      &lt;Nullable&gt;enable&lt;/Nullable&gt;
      &lt;ImplicitUsings&gt;enable&lt;/ImplicitUsings&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Dapper&quot; Version=&quot;2.0.123&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore&quot; Version=&quot;6.0.6&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Design&quot; Version=&quot;6.0.6&quot;&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.SqlServer&quot; Version=&quot;6.0.6&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Tools&quot; Version=&quot;6.0.6&quot;&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;System.Data.SqlClient&quot; Version=&quot;4.8.3&quot; /&gt;
    &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p><code>ApplicationDbContext.cs</code>:</p>
  <pre><code>using BookClub.Models;
  using Microsoft.EntityFrameworkCore;
  
  namespace BookClub.Data;
  
  public class ApplicationDbContext : DbContext
  {
    public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; options) : base(options)
    {
    }
  
    public DbSet&lt;Category&gt; Categories { get; set; }
  }
  </code></pre>
  <p><code>CategoryController.cs</code>:</p>
  <pre><code>using BookClub.Data;
  using Microsoft.AspNetCore.Mvc;
  
  namespace BookClub.Controllers;
  
  public class CategoryController : Controller
  {
    private readonly ApplicationDbContext _db;
  
    public CategoryController(ApplicationDbContext db)
    {
      _db = db;
    }
  
    public IActionResult Index()
    {
      var categoryList = _db.Categories.ToList();
      return View();
    }
  }
  </code></pre>
  <p>System:</p>
  <ul>
  <li>macOS 12.2.1</li>
  </ul>
  <p>Applications:</p>
  <ul>
  <li>VS Code</li>
  <li>Docker - SQL Server</li>
  <li>SQL Server extension for VS Code</li>
  </ul>