How to publish database to Azure using Visual Studio Code on Mac?

asp.net-core azure azure-sql-database entity-framework-core visual-studio-code

Question

I built asp.net MVC Core web app using Visual Studio Code on Mac. The app is working with database (EF) in localhost all along.

I have an Azure account with Web App + SQL Database created. Then I have changed the connection string in appsetting.json to that provided by Azure SQL Database.

The website is deployed to Azure Web App using git push azure master command. But how to publish the database to Azure?


In appsetting.json :

"ConnectionStrings": {
"AzureConnection": "Server=tcp:myapp-test.database.windows.net,1433;Initial Catalog=myapp-test;Persist Security Info=False;User ID=***;Password=***;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
}

Output after I run dotnet ef database update :

bash-3.2$ dotnet ef database update
Project MyApp (.NETCoreApp,Version=v1.0) will be compiled because project is not safe for incremental compilation. Use --build-profile flag for more information.
Compiling BlueJacket for .NETCoreApp,Version=v1.0
Bundling with configuration from /Users/matt/Documents/MyApp/bundleconfig.json
Processing wwwroot/css/site.min.css
Processing wwwroot/js/site.min.js
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:05.1136780
(The compilation time can be improved. Run "dotnet build --build-profile" for more information)
Done.
1
0
1/4/2017 9:08:10 AM

Popular Answer

Have you created a database in Azure yet? Do you have a connection string?

Open Package-Manager and run "Update-Database"

0
1/4/2017 6:15:13 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow