title: How do I get migration seed data for a default user with pw and role, which works locally to work when I publish it to Azure?
body: <p>I have an MVC 4 EF web project with a code-first sql server db that very closely follows the basic and usual structure of any you would see as an example anywhere on the web. </p>
  
  <p>I have read EVERY article posted on the internet concerning how to do what I need and none of them so far make any difference to my situation. I am not doing anything extraordinary, I just took out the 'Register' new user capability as needed by my project, and am trying to create a couple of users as login points by including them in the Migrations/Configuration.cs file like this:</p>
  
  <pre><code>    protected override void Seed (EntityContext context)
      {
          if (!WebSecurity.Initialized)
              WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
  
          if (!Roles.RoleExists("Administrator"))
              Roles.CreateRole("Administrator");
  
          if (!WebSecurity.UserExists("Owner"))
              WebSecurity.CreateUserAndAccount("Owner", "password");
  
          if (!Roles.GetRolesForUser("Owner").Contains("Administrator"))
              Roles.AddUsersToRoles(new[] { "Owner" }, new[] { "Administrator" });
  
          if (!WebSecurity.UserExists("fred"))
              WebSecurity.CreateUserAndAccount("leemid", "pw");
          if (!Roles.GetRolesForUser("leemid").Contains("Administrator"))
              Roles.AddUsersToRoles(new[] { "leemid" }, new[] { "Administrator" });
  
          base.Seed(context);
      }
  </code></pre>
  
  <p>Everything works beautifully locally, but when I publish to my Azure account, where everything is set up properly as near as I can tell, the app appears correctly except that I can't login as my seeded user. I have connected to my Azure db using SQL Management Studio and all of the UserProfile and webpages_ tables are there, the app specific ones are not because the code-first hasn't had a chance to build the yet (I assume), but there are no users or roles. Locally, everything is built and populated as expected.</p>
  
  <p>I have added the often suggested code in the root Web.config file thus:</p>
  
  <pre><code>&lt;system.web&gt;
    &lt;roleManager enabled="true" defaultProvider="SimpleRoleProvider"&gt;
        &lt;providers&gt;
            &lt;clear/&gt;
            &lt;add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData"/&gt;
        &lt;/providers&gt;
    &lt;/roleManager&gt;
    &lt;membership defaultProvider="SimpleMembershipProvider"&gt;
        &lt;providers&gt;
            &lt;clear/&gt;
            &lt;add name="SimpleMembershipProvider"
                 type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData"/&gt;
        &lt;/providers&gt;
    &lt;/membership&gt;
  </code></pre>
  
  <p>It certainly took all of this to accomplish successful publishing of the site, but I am frustrated by the lack of success in seeding the users. Any one solved this already?</p>