title: Azure Continuous Deployment - Code First Migration seeding issue (MVC 5)
body: <p>I've set up the <strong>Continuous Deployment</strong> in Microsoft Azure (Web App) using a ButBucket Git repo.  Code First Migrations works well on my computer, it creates tables and seeds them, but when I sync the branch, <strong>the seed method of the migration is not run on Azure</strong>.</p>
  
  <p>So Azure gets the changes from BitBucket, creates the tables as needed, but does not run the seed method (every table remains empty).</p>
  
  <p><strong>Can you suggest a solution to run the Seed method on Azure automatically when a new migration is applied</strong> (or after every time Azure builds from BitBucket if that is the only solution)?</p>
  
  <p><em>Additional Info:</em></p>
  
  <ul>
  <li>MigrationHistory table contains the migrations, so they were run.</li>
  <li>I've set AutomaticMigrationsEnabled = true; but the problem remains</li>
  <li>On Azure there is a Web App which is built and migrated, and an SQL Database which is referenced in the ConnectionString in Web.config</li>
  </ul>
  
  <p><em>Configuration.cs</em></p>
  
  <pre><code>internal sealed class Configuration : DbMigrationsConfiguration&lt;MyInsidR.Models.ApplicationDbContext&gt;
  {
      public Configuration()
      {
          AutomaticMigrationsEnabled = true;
          ContextKey = "MyInsidR.Models.ApplicationDbContext";
      }
  
      protected override void Seed(ApplicationDbContext context)
      {
          //  This method will be called after migrating to the latest version.
  
          //  You can use the DbSet&lt;T&gt;.AddOrUpdate() helper extension method 
          //  to avoid creating duplicate seed data. E.g.
          //
          //    context.People.AddOrUpdate(
          //      p =&gt; p.FullName,
          //      new Person { FullName = "Andrew Peters" },
          //      new Person { FullName = "Brice Lambson" },
          //      new Person { FullName = "Rowan Miller" }
          //    );
          //
  
          context.Prophecies.AddOrUpdate(p =&gt; p.ID,
              new Prophecy() { ID = 1, Text = "Fűben iszogatós, sírva nevetős."}
          );
  
          context.Interesteds.AddOrUpdate(x =&gt; x.ID,
              new Interested() { ID = 1, Email = "teszt.elek@gmail.com", FirstName = "Elek", LastName = "Teszt", RegistrationDate = DateTime.Now }
          );
  
          var tag1 = new Tag() { ID = 1, Name = "Karaoke", ApplyTo = TagApplication.All, Type = TagType.Games };
          var tag3 = new Tag() { ID = 3, Name = "4 rooms", ApplyTo = TagApplication.All, Type = TagType.Misc };
          var tag4 = new Tag() { ID = 4, Name = "Helipad", ApplyTo = TagApplication.All, Type = TagType.Vip };
  
          context.Tags.AddOrUpdate(x =&gt; x.ID,
              tag1, tag3, tag4
          );
  
          var indicatorIcon1 = new IndicatorIcon() { ID = 1, VisualClass = IndicatorIcon.VisualClassType.Hidden, Name = "No Indicator Icon", Description = "Nothing special, just a regular place or event." };
          var indicatorIcon2 = new IndicatorIcon() { ID = 2, VisualClass = IndicatorIcon.VisualClassType.Fire, Name = "Hot", Description = "This place or event is very popular at the moment. There are big parties and a big fuss around it." };
          context.IndicatorIcons.AddOrUpdate(x =&gt; x.ID,
              indicatorIcon1, indicatorIcon2
          );
  
          AddUserAndRole(context);
      }
  
      bool AddUserAndRole(ApplicationDbContext context)
      {
          var roleManager = new RoleManager&lt;IdentityRole&gt;(new RoleStore&lt;IdentityRole&gt;(context));
          var identityResult = roleManager.Create(new IdentityRole("Admin"));
  
          var userManager = new UserManager&lt;ApplicationUser&gt;(new UserStore&lt;ApplicationUser&gt;(context));
          var user = new ApplicationUser()
          {
              UserName = "myinsidr@gmail.com",
          };
          identityResult = userManager.Create(user, "Qwertz1234!");
          if (identityResult.Succeeded == false)
              return identityResult.Succeeded;
  
          identityResult = userManager.AddToRole(user.Id, "Admin");
          return identityResult.Succeeded;
      }
  }
  </code></pre>
  
  <p>(I've found questions and solutions related to seed method issue only for direct deployment from Visual Studio, but that's not the way I would like to go.</p>
  
  <p>Also there are solutions using different SQL management projects, but I think code first migrations inside the MVC project is the cleanest solution if it works like on my local machine) </p>