I have the need of updating my remote database in my Azure cloud from time to time, with new migrations and seed data.

The command below is the same as the normal Update-Database, just with additional arguments provided, for connecting to the remote database.

Update-Database -StartUpProjectName "YourSolution.YourProject" -ConnectionString "Server=tcp:your_server.database.windows.net,1433;Database=your_database;User ID=your_user@your_server;Password=your_password;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;Max Pool Size=100;" -ConnectionProviderName "System.Data.SqlClient"

Always be sure to run this command in the project where your Entity Framework configuration resides.

Lets break the command down in pieces to see what arguments are supplied.

-StartUpProjectName "YourSolution.YourProject"

Sets the startup project, where to look for the “Web.config” file. If your solution have multiple projects, one with the Entity Framework configuration, and one with your Web project.

-ConnectionString "Server=tcp:your_server.database.windows.net,1433;Database=your_database;User ID=your_user@your_server;Password=your_password;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;Max Pool Size=100;"

Sets the connection information to your server, database informartion and some additional parameters, which I will not cover.

When you have provided your connection information, fire the command, and you should see something as below:

Update-Database.PNG