title: How to change a clustered index in Entity Framework 6.1 Code First model and apply it to an Azure database
body: <p>Using the Entity Framework 6.1 code first model, what is the best way to go about changing the clustered index on a table from the default ID to another set of columns. Azure doesn't allow a table without a clustered index.</p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>  public partial class UserProfile 
    {
      public override Guid ID { get; set; }
  
      [Index( "CI_UserProfiles_UserID", IsClustered = true)]
      public Guid UserID { get; set; }
  
      [Required]
      public Guid FieldID { get; set; }
  
      [Required]
      [StringLength(400)]
      public string Value { get; set; }
   }
  </code></pre>
  
  <p>On the table <code>UserProfiles</code>, <code>ID</code> is already the primary key and clustered index. Adding </p>
  
  <pre class="lang-cs prettyprint-override"><code>[Index( "CI_UserProfiles_UserID", IsClustered = true)] 
  </code></pre>
  
  <p>to UserID creates this migration:</p>
  
  <pre class="lang-cs prettyprint-override"><code>CreateIndex("dbo.UserProfiles", "UserID", clustered: true, name: "IX_UserProfiles_UserID");
  </code></pre>
  
  <p>Executing the migration generates the following error:</p>
  
  <blockquote>
    <p>Cannot create more than one clustered index on table 'dbo.UserProfiles'. Drop the existing clustered index
    'PK_dbo.UserProfiles' before creating another.</p>
  </blockquote>