Web deploy to Azure with entity framework
Hi,
We have a issue with code first migrations. A cannot find a proper solution on how to run migrations on azure sql.
I finally created a batch script to do the magic but it doesn't seem like I have the rights to do so.
If I run the following script from my local machine everythings works as it should but we need it to be automated with the deployment process.
Do you have any suggestions og best practises for this?
SET AssemblyName=OmegaMVC5
SET StartUpDirectory=..\OmegaMVC5\bin\
SET ConnectionString=Server=tcp:xxxxxx,1433;Database=Omega;User ID=xxxx;Password=xxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True
SET ConnectionStringProvider=System.Data.SqlClient
SET ConfigFilePath=..\%CD%\OmegaMVC5\web.config
SET MigrateExe=..\packages\EntityFramework.6.1.3\tools\migrate.exe
%MigrateExe% %AssemblyName%.dll /startUpDirectory:%StartUpDirectory% /startUpConfigurationFile:"%ConfigFilePath%" /connectionProviderName:"%ConnectionStringProvider%" /connectionString:"%ConnectionString%" /verbose
Thanks,
Kenneth
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

Support Staff 1 Posted by Feodor Fitsner on 22 Jun, 2016 02:53 PM
Hi Kenneth,
Is there any reason you can't run the same script on AppVeyor! Are you getting any errors?
-Feodor Fitsner, AppVeyor
2 Posted by kenneth on 23 Jun, 2016 07:56 AM
Hi Feodor,
I want the script to run after deployment. The only place I have found to place the script via web deploy is under web deploy --> Settings --> General --> Pre and Post-sync commands.
The problem is that azure doesn’t allow me to run the batchfile. It gives me:
“Could not complete an operation with the specified provider ("runCommand") when connecting using the Web Management Service. This can occur if the server administrator has not authorized the user for this operation. runCommand http://go.microsoft.com/fwlink/?LinkId=178034 Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER.»
Is there another place where I could place the script?
Med vennlig hilsen/Best regards from
Kenneth Ådalen
Fra: Feodor Fitsner [mailto:[email blocked]]
Sendt: 22. juni 2016 16:54
Til: Kenneth Ådalen <[email blocked]>
Emne: Re: Web deploy to Azure with entity framework [Questions #2425]
Support Staff 3 Posted by Feodor Fitsner on 23 Jun, 2016 05:40 PM
I think you could update the database from AppVeyor build worker by accessing it remotely. Make sure Azure SQL firewall is updated to allow AppVeyor IPs: http://www.appveyor.com/docs/build-configuration#ip-addresses
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:07 AM.